1 / 53

MES905: Building Mobile Web Applications with SQL Anywhere

MES905: Building Mobile Web Applications with SQL Anywhere. David Loop Principle Consultant daveloop@ianywhere.com August 15-19, 2004. The Enterprise. Unwired. The Enterprise. Unwired. Industry and Cross Platform Solutions. Manage Information. Unwire Information. Unwire People.

indra
Download Presentation

MES905: Building Mobile Web Applications with SQL Anywhere

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MES905: Building Mobile Web Applications with SQL Anywhere David Loop Principle Consultant daveloop@ianywhere.com August 15-19, 2004

  2. The Enterprise. Unwired.

  3. The Enterprise. Unwired. Industry and Cross Platform Solutions Manage Information Unwire Information Unwire People • Adaptive Server Enterprise • Adaptive Server Anywhere • Sybase IQ • Dynamic Archive • Dynamic ODS • Replication Server • OpenSwitch • Mirror Activator • PowerDesigner • Connectivity Options • EAServer • Industry Warehouse Studio • Unwired Accelerator • Unwired Orchestrator • Unwired Toolkit • Enterprise Portal • Real Time Data Services • SQL Anywhere Studio • M-Business Anywhere • Pylon Family (Mobile Email) • Mobile Sales • XcelleNet Frontline Solutions • PocketBuilder • PowerBuilder Family • AvantGo Sybase Workspace

  4. The Mobile World

  5. Mobile “Always Available” Applications • Extend enterprise information to mobile workers on demand • Mobile workers need to be productive anywhere, anytime • Wireless access is not 100% (underground, countryside, restricted areas) • “Always available” model leverages: • Local Data Store • Accesses important/frequent information offline • Synchronize when necessary • Increases batterly life and performance • Saving on connection costs • Enterprise Information • Interface with enterprise systems for data and access • Appy and enforce existing enterprise security standards

  6. Challenges to Mobile Web Applications • Mobilize Enterprise Data • Security • Performance • Reliability • Development Effort • Deployment Effort • Cost But these are not specific to Mobile Web Applications

  7. Real Challenges to Mobile Web Applications • Mobile application adoption, usability • Enterprise integration and access • Enterprise security • device, transmission and authentication • Distributed application logic • Device characteristics • form follows function • Device disparity • Distributed and mobile deployment • Re-deployment and healing • Development learning curve

  8. Why Mobile Applications with M-Business Anywhere? • Delivers web content and web applications • Web developers leverage their existing skill sets with open standards • rapid development • low cost of ownership • rich environment • Dynamic Mobility and Connectivity • Widest range of mobile devices over any network • Seamless transition between online and offline • Centralized User, Content and End-to-End Security Management • Mobile Portal Self-Service Configuration

  9. M-Business Anywhere (M-BA) • M-BA Components • Multi-platform client browser • HTTP/Synchronization Server • Features • Integrates into existing web • Synchronizes and caches web pages on client • Auto-Sensing and On-Demand • Custom client and server logic • Integration with UltraLite and MobiLink • Benefits • Ease of developing web applications • Always Available • Multi-platform

  10. M-Business Anywhere Architecture

  11. UltraLite for M-Business Anywhere • UltraLite local data store • Relational database • SQL open standard • Fast, Efficient, Robust, Secure • Encryption and authentication • MobiLink • Synchronize directly to your enterprise systems • Encrypted stream and authentication to enterprise • Script based logic through standard SQL • UltraLite for M-Business Anywhere API • HTML embeds JavaScript • JavaScript to call API • Execute standard SQL • Optimized access (9.0.2) • Performance AND all other benefits of an RDBMS

  12. UltraLite Development • UltraLite Database • Created and opened programmatically through a schema file • Interface through API classes • Web page embedded JavaScript to select, insert, update, delete, synchronize • UltraLite Schema • UL Schema Painter to create or modify • Schema file (.usm) copied down to device through channel • Synchronization • Initiated through user action or through channel sync (9.0.2) • Connection made to MobiLink • MobiLink scripts control data movement using standardized script names and events • If a script exists, data can be moved back and forth. • Separate scripts for upload and download

  13. UltraLite for M-Business Anywhere Architecture Web Content M-Business Anywhere M-BA Client Browser Web Apps Enterprise Systems MobiLink Data ULPod UltraLite

  14. Tasty Baked Goods – Solution Sample • M-Business Anywhere and UltraLite POD Solution Sample

  15. Tasty Baked Goods - Route Management Tasty Baked Goods - Route Management • Route Management • Manage Bakery Delivery Route • Route is downloaded to device • Products that are ordered, delivered and returned updated in database • Store manager signs the invoice • Historical reports and graphical displays of data • Two way sync

  16. Tasty Baked Goods – Solution Sample • M-Business Anywhere and UltraLite POD Solution Sample • DEMO

  17. Getting Technical • Client side processing accesses the UltraLite database • Manipulating the Client side browser • Synchronization • Deployment

  18. Getting Technical • Client side processing accesses the UltraLite database • Access to the UltraLite POD • Connection to UltraLite database • Issue SQL commands to UltraLite database • UltraLite for M-Business Anywhere API • Manipulating the Client side browser • Synchronization • Deployment

  19. Access to the UltraLite POD • M-Business Anywhere Group Channels • HTML with embedded JavaScript • JavaScript files access from HTML • UltraLite schema file (USM) • JavaScript will attempt to: • Reconnect to the UltraLite database specified • if that fails, create new connection to the UltraLite database • if the database doesn’t exist, create it from the schema • Once the POD object has been created • Continues to exist • Persist connections between different pages

  20. Access to UltraLite POD • UltraLite POD is looking for the string prefix "iAnywhere.UltraLite.DatabaseManager" dbMgr = CreateObject( "iAnywhere.UltraLite.DatabaseManager.route_mgmt" ); var dir = dbMgr.directory; var parm = dbMgr.createConnectionParms(); parm.connectionName = "route_mgmt"; parm.databaseOnCE = dir + "\\rm.udb"; parm.schemaOnCE = dir + "\\rm.usm";

  21. PODS ULPod = “iAnywhere.UltraLite.DatabaseManager” + “.unique_identifier” Page 1 Page 2 Page 1 dbMgr = CreateObject con = dbMgr.createDatabase … // may or may not // close con on any page dbMgr = CreateObject con = dbMgr.reOpenConnection … // choose to close con.close dbMgr = CreateObject con = dbMgr.openConnection … ULPod in M-Business Anywhere Client MBA Client “iAnywhere.UltraLite.DatabaseManager.route_mgmt”

  22. Connection to UltraLite database try { conn = dbMgr.reOpenConnection( "route_mgmt" ); if ( conn == null ) { conn = dbMgr.openConnectionWithParms( parm ); } } catch ( ex ) { if ( dbMgr.sqlCode == dbMgr.SQLError.SQLE_ULTRALITE_DATABASE_NOT_FOUND ) { try { conn = dbMgr.createDatabaseWithParms( parm ); …

  23. Issue SQL commands to UltraLite database this.getProducts = function( my_cust_id ) { var query = “ SELECT P.name " + " FROM customer C, sales_history SH JOIN product P ON PRODUCT_ID " + " WHERE C.CUSTOMER_ID = SH.CUSTOMER_ID " + " AND C.CUSTOMER_ID = ?”; var stmt = this.dbConn.conn.prepareStatement( query, "stmt_get_products" ); stmt.setIntParameter(1, my_cust_id); var rs, prod_array = new Array; try { rs = stmt.executeQuery( null ); rs.moveBeforeFirst(); while ( rs.moveNext() ) { prod_array[prod_array.length] = rs.getString(1); } } catch ( ex ) { // handle exception } finally { stmt.close(); } return prod_array; }

  24. UltraLite for M-Business AnywhereAPI Object Heirarchy

  25. API Object HeirarchyConnection

  26. API Object HeirarchyDynamic SQL

  27. API Object HeirarchyTable

  28. API Object HeirarchySynchonization

  29. Getting Technical • Client side processing accesses the UltraLite database • Manipulating the Client side browser • API to access to objects on the browser • From the browser to UltraLite and back • Synchronization • Deployment

  30. Manipulating the Client side browser • JavaScript in HTML must access the browser objects • DOM API used for finding and accessing objects • JavaScript events for interacting with User • onclick, onsubmit, onload, etc • Methology shift from server-side • Server-Side DHTML • Create full HTML file on server • HTML tags and data are both string • Once sent to client, changes must be resubmitted by client to server and back • Client-Side DHTML • HTML object already exists • add HTML objects dynamically through DOM API • Web pages do not need refreshing (re-downloading)

  31. Manipulating DOM Consider the following HTML BODY <head><script>…</script></head> <body> <p align="center"><b>List All Products</b></p> <table border="1" cellpadding="1" cellspacing="1" width="100%" id="TableList"> </table> <p><a href="main_page.htm">Back to main page</a></p> <p><a href="insert_page.htm">Insert new Product</a></p> </body>

  32. Manipulating DOM <table border="1" cellpadding="1" cellspacing="1" width="100%" id="TableList"> </table> var idx, objTable, eleTR, eleTD1, eleTD2; objTable = document.getElementById(“TableList”); for ( idx=0; idx<array.length; I++ ) { eleTR = objTable.insertRow(idx); eleTR.style.color = “black”; eleTD1 = eleTR.insertCell(0); eleTD1.appendChild( document.createTextNode(idx) ); eleTD2 = eleTR.insertCell(1); eleTD2.appendChild( document.createTextNode(array[idx]) ); }

  33. Manipulating DOM List All Products Back to main page Insert new Products

  34. SELECT Example of Client-Side DHTML <html><head><script src="common.js"></script> <script language="JavaScript1.2"> function Display() { try { var pstmt = conn.prepareStatement( "SELECT FIRST cust_name FROM ULCustomer ORDER BY cust_id", "cust_list_ps" ); var rs = pstmt.executeQuery("cust_list_ps"); rs.moveNext(); var objTitle = document.getElementById("Heading_Customer"); objTitle.appendChild(document.createTextNode(rs.getString(1))); } catch ( ex ) { // handle exception } } </script> </head><body onload="Display()" > <H1 ID="Heading_Customer"></H1> </body></html> * Database and “conn” are handled in common.js

  35. INSERT Example of Client-Side DHTML <script language="JavaScript1.2"> function insertRow() { … var pstmt = conn.prepareStatement( “INSERT INTO ULCustomer (cust_name) values (?)", "cust_insert_ps" ); pstmt. setStringParameter(1, document.insert.custname.value); pstmt.executeStatement("cust_insert_ps"); … } </script> </head><body><form name="insert"> <input type="text" name="custname" size="10"><br> <input type="button" value="Insert"onclick="insertRow();"><br> <input type="reset" value="Reset"> </form></body></html>

  36. Getting Technical • Client side processing accesses the UltraLite database • Manipulating the Client side browser • Synchronization • Classes from the API • Setting up the parameters • Coding • Architecture • Deployment

  37. UltraLite POD Synchronization with MobiLink Web Content M-Business Anywhere M Business Anywhere Client Web Apps Enterprise Database MobiLink Content ULPod UDB

  38. API Object HeirarchySynchonization

  39. Data Synchronization Configuration • Synchronization • MobiLink for data • MobiLink sync configuration can be embedded in app • M-Business Anywhere for application UI and logic • Integrated in ActiveSync Hotsync, use M-Business Connect for wireless • Synchronization configuration for MobiLink within M-Business Client

  40. UltraLite Synchronization conn.syncParms.setStream( conn.syncParms.STREAM_TYPE_TCPIP ); conn.syncParms.setUserName( document.dbsync.syncusrname.value ); conn.syncParms.setVersion( document.dbsync.syncver.value ); // stream parms include host and port conn.syncParms.setStreamParms( document.dbsync.syncparm.value ); conn.syncParms.setDownloadOnly( true ); conn.saveSyncParms(); window.showBusy = true; conn.synchronize(); window.showBusy = false; if ( conn.syncResult.getUploadOK() != true ) { alert( "Upload is not OK!" ); } else { alert( "Synchronization finished!" ); }

  41. Getting Technical • Client side processing accesses the UltraLite database • Manipulating the Client side browser • Synchronization • Deployment • M-Business Anywhere • Deploying Channels • Schema file • Deployment Options

  42. Deploying UltraLite for M-Business Anywhere • Develop a Group for all your download content • Each downloadable object is a Channel • USM • DLL • Root HTML file (will bring its children down too) Web Content M-Business Anywhere USM M-Business Anywhere Admin ULPod9.dll

  43. Application Deployment • Deployment - distributed as M-Business channels • Ultralite Pod runtime (500 – 600 KB) • Web applications • Schema file

  44. Architecture of the Client Win32 M-BA Client Each Channel Group gets its own directory for web pages All binaries including UL Pod DLLs, USMs, ULConnect.exe • Create one Channel Group exclusively for downloading the UL binaries • Only download either ULPOD9.DLL or ULPODCLIENT9.DLL • Each Channel Group that uses UltraLite, should download its own USM

  45. Where Does the Database Come From? • Create a USM file using Schema Painter • Generate a USM from from an ASA database using ulinit ulinit -f ../html/common/rm.usm -n Delivery -c "dsn=remote"

  46. Simplified Development Steps • Create schema for database using Schema Painter • Develop web pages that access database • Create Group on M-Business Anywhere Server • Create channels for all download content • Add users to the Group • Use the Client to download the content and test • Generate MobiLink synchronization scripts* • Modify Web pages to invoke synchronization • Client does a “Sync All” for channels and test * this process can be greatly helped by using an ASA remote to auto-generate scripts

  47. UltraLite POD for M-Business Anywhere (9.0.2) • Two Options for POD implementation • Standalone • Client / Engine (9.0.2) • Only one should be deployed

  48. UltraLite POD – Standalone Runtime • Accesses databases directly and quickly but can not be shared. • Through ULPod9.dll • Deployment to: • Win32, Windows CE, Palm OS devices

  49. UltraLite POD - UltraLite Engine • UltraLite client communicates with UltraLite engine to access databases. • Databases can be shared by different applications. • Deployment: • Win32, Windows CE • Requirements • ulpodclient9.dll through an M-BA Channel • dbuleng9.exe deployed separately • ulpodclient9.dll replaces ulpod9.dll functionality • Currently only one of ulpod9.dll or ulpodclient9.dll should be deployed to a M-BA Client • POD technology will pass “iAnywhere.UltraLite.DatabaseManager” for acceptance • Only needed if UltraLite will be access outside of M-BA

  50. One-Button-Synch (9.0.2) • M-Business Anywhere Channel Sync will initiate a MobiLink/UltraLite Synchronization • Deploy • ulconnect.exe • ulconnect.usm • Each successful synchronization (previous example) adds a connection entry into ULConnect.UDB • Each connection entry will be synchronized • Connection entries can be skipped • Connection.skipMBASync = true; • Only exists for Win32 and PocketPC • PocketPC has a CAB that will install itself

More Related