Instruction manuals

MAF win32-tutorial

Description
MAF
Published
of 18
187
Published
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Similar Documents
Share
Transcript
  Tutorial for Building Mobile Applications for Win32  19-1 19 Tutorial for Building Mobile Applications forWin32 To demonstrate the steps involved in building Mobile applications for the Win32 platform, this tutorial presents a simplified Mobile field service example. The following sections guide you through the Mobile application development process for the Win32 platform. When developing, you can use Visual Studio 2003. ■ Section19.1, Plan the Mobile Application Demo for Win32 ■ Section19.2, Description of Tasks for Win32 Demo ■ Section19.3, Administer the Application ■ Section19.4, Execute the Application on the Mobile Client for Web-to-Go 19.1Plan the Mobile Application Demo for Win32 Let us assume that you have a TASK  table on the server that contains information about tasks that must be accomplished by your Mobile field service technicians for a day. Listed below is the TASK  table structure. Each row in the TASK  table describes work to be done at a customer site. ■  TASK(ID number(4) primary key ■  Description varchar(40) not null ■  CustName varchar(30) not null ■  CustPhone varchar(12) ■  CustStAddr varchar(40) not null ■  CustCity varchar(40) not null ■  Notes varchar(100) Let us also assume that you have three service technicians, Tom, Dick, and Harry. You want to assign all the tasks in the City of Cupertino to Tom, those in the City of Mountain View to Dick, and those in the City of Palo Alto to Harry. You envision your application to work as follows:Each service technician has a laptop that he uses to obtain his task list in the morning. He will perform the task during the day and will update the Notes column of a task with information about its status or what he has done. At the end of his work day, the service technician uploads his changes to the server.We will assume the following environment for your application. ■ The Mobile Server is installed on the machine called  mserver .  Description of Tasks for Win32 Demo 19-2 Oracle Database Lite Developer’s Guide ■ The test Oracle database that is used to store the application data and the Mobile Server Repository is installed on the machine oradbserver  with the listener on port 1521. The Oracle database instance name is orcl . We will assume that you can log in to the database with the user name  master  and password  master . You can substitute any user for  master  so long as the user has the right privileges. ■ You have already installed the Mobile Development Kit on your development machine.Our implementation plan is as follows. The exact sequence of commands for each step is given later. 1. Create the TASK  table in the oradbserver  and insert some rows into it. This step is not needed if you already have a database that contains a table similar to TASK . 2. Use MDW to create a publication that contains a single publication item based on the TASK  table. 3. Use the Packaging Wizard to define and publish the Mobile Field Service application to the Mobile Server. 4. Use the Mobile Manager to create users Tom, Dick, and Harry on the Mobile Server. Grant all users the privilege to execute the Mobile Field Service application and create a subscription for each of them. 5. Install the Oracle Database Lite 10  g  client on your development machine in a separate directory (emulating a technician's machine). Run the Mobile Sync application to download the Mobile Field Service application (which is currently empty) and data. 6. On your development machine, use mSQL to look at the rows in the TASK  snapshot and update the rows by entering notes in the Notes column. 7. Synchronize the changes you made in the snapshot with the server database by running the Mobile Sync application again. 8. Connect to the server database and check that your changes are there. Modify the Description of one of the rows for the customer in Cupertino. 9. Run the Mobile Sync application again. You will see the changes that you made on the server are in the snapshot in the client database. 10. Develop a C or C++ program against Oracle Database Lite to: ■ show the tasks to the technician, and ■ let the technician choose a task and enter notes for it 11. Use the Packaging Wizard to update the application to include the above program.The Mobile Server is now ready for real life testing. 19.2Description of Tasks for Win32 Demo The following sections describe the command sequence for successfully creating the Win32 demo: 1. Section19.2.1, Create TASK Table on the Server Database 2. Section19.2.2, Create Publication for Application 3. Section19.2.3, Package the Application Using the Packaging Wizard   Description of Tasks for Win32 Demo Tutorial for Building Mobile Applications for Win32  19-3 19.2.1Create TASK Table on the Server Database We will use the Oracle 10  g  thin JDBC driver to connect to the Oracle database running in the oradbserver  machine. Ensure that the thin JDBC driver (< ORACLE_HOME  > \jdbc\lib\ojdbc14.jar ) file is included in your CLASSPATH  environment variable. Connect as  master  with password  master . D:>msql master/master@jdbc:oracle:thin:@oradbserver:1521:orcl Now create the TASK  table in this database. The SQL script to create and populate the server database is provided in the following directory.< ORACLE_HOME  > \mobile\sdk\samples\odbc\win32\MFS SQL>create table TASK( 1> ID number(4) primary key,2> Description varchar(40) not null, 3> CustName varchar(30) not null,4> CustPhone varchar(12),5> CustStAddr varchar(40) not null, 6> CustCity varchar(40) not null,7> Notes varchar(100)); We will now insert four rows into this table. SQL> insert into task values(1,'Refrigerator not  working','Able','408-999-9999','123 Main St.','Cupertino',null);SQL> insert into task values(2,'Garbage Disposal broken','Baker','408-888-8888','234 Central Ave','Cupertino',null);SQL> insert into task values(3,'Refrigerator makes noise','Choplin','650-777-7777','1 North St.','Mountain View',null);SQL> insert into task values(4,'Faucet leaks','Dean','650-666-6666','10 University St.','Palo Alto','Beware of dogs');SQL> commit;SQL> exit 19.2.2Create Publication for Application As described fully in Chapter5, Using Mobile Database Workbench to Create Publications , you can use MDW to create your publication. Launch MDW by executing oramdw   from <ORACLE_HOME> /Mobile/Sdk/bin . The following sections detail how to use MDW to create a publication for the application in this tutorial. ■ Section19.2.2.1, Create a Project ■ Section19.2.2.2, Create Publication Item ■ Section19.2.2.3, Create Publication 19.2.2.1Create a Project Create a new project for this application by selecting File->New->Project . This brings up a wizard where you enter the following information: Note: While creating this publication, use Chapter5, Using Mobile Database Workbench to Create Publications  for a deeper understanding of how to use MDW and the type of information that you must provide.  Description of Tasks for Win32 Demo 19-4 Oracle Database Lite Developer’s Guide 1. Define a name and location for the project. 2. Enter the username, password, JDBC driver type, database host, database port and database SID for the Mobile repository. Username and password are  master/master , and the database URL is jdbc:oracle:thin:@oradbserver:1521:orcl .Provide the Mobile Repository access information. Because you are interacting with the repository to create and manipulate synchronization objects, including the SQL scripts for the publication items, you need access to the Mobile Repository. 3. Specify schema username and password. Enter the user and password of the schema owner for the schema that you are using for the Mobile application. The Mobile application schema contains all database tables, views, synonyms used to  build the snapshots for the application. 4. Verify the information that you entered and click Finish . 19.2.2.2Create Publication Item For this project, you need to create the taskpi  publication item.Perform the following to create the publication item: 1. Start the new publication item wizard by selecting File->New->Publication Item . 2. Enter the name as taskpi  and the type as Fast . If you want this publication item to use automatic synchronization, make sure that the Enable Automatic Synchronization checkbox is checked. Uncheck to use manual synchronization. Click Next . 3. Select the schema name as MASTER , the object type as Table , and leave the object filter blank. Click Search . When the search ends, select the task  table from the object list. Click Next . 4. Click >>  to select all of the columns in the task  table. Click Next . 5. In the Query tab, select Edit  to edit the query, as follows: select * from master.task where CustCity = :city Click Next . 6. If you checked the ’Enable Automatic Synchronization’ checkbox, then an additional screen comes up. This screen enables you to specify users included in the compose. By default, all users are included. Leave checkbox unchecked and click Next . 7. The Summary page displays. Click Finish . Note: For more information, see Section5.2, Create a Project . Note: For more information, see Section5.4, Create a Publication Item .

0580_s14_qp_12

Jul 22, 2017
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks
SAVE OUR EARTH

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!

x