MES905:  Building Mobile Web Applications with SQL Anywhere
This presentation is the property of its rightful owner.
Sponsored Links
1 / 53

MES905: Building Mobile Web Applications with SQL Anywhere PowerPoint PPT Presentation


  • 80 Views
  • Uploaded on
  • Presentation posted in: General

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

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


MES905: Building Mobile Web Applications with SQL Anywhere

David Loop

Principle Consultant

[email protected]

August 15-19, 2004


The Enterprise. Unwired.


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


The Mobile World


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


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


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


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


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


M-Business Anywhere Architecture


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


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


UltraLite for M-Business Anywhere Architecture

Web

Content

M-Business

Anywhere

M-BA

Client

Browser

Web Apps

Enterprise

Systems

MobiLink

Data

ULPod

UltraLite


Tasty Baked Goods – Solution Sample

  • M-Business Anywhere and UltraLite POD Solution Sample


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


Tasty Baked Goods – Solution Sample

  • M-Business Anywhere and UltraLite POD Solution Sample

  • DEMO


Getting Technical

  • Client side processing accesses the UltraLite database

  • Manipulating the Client side browser

  • Synchronization

  • Deployment


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


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


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";


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”


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 );


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;

}


UltraLite for M-Business AnywhereAPI Object Heirarchy


API Object HeirarchyConnection


API Object HeirarchyDynamic SQL


API Object HeirarchyTable


API Object HeirarchySynchonization


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


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)


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>


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]) );

}


Manipulating DOM

List All Products

Back to main page

Insert new Products


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


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>


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


UltraLite POD Synchronization with MobiLink

Web

Content

M-Business

Anywhere

M

Business

Anywhere

Client

Web Apps

Enterprise

Database

MobiLink

Content

ULPod

UDB


API Object HeirarchySynchonization


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


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!" );

}


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


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


Application Deployment

  • Deployment - distributed as M-Business channels

    • Ultralite Pod runtime (500 – 600 KB)

    • Web applications

    • Schema file


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


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"


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


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


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


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


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


DB

MobiLink A

DB

MobiLink B

DB

MobiLink C

ULConnect.exe

One-Button-Synch Architecture

ULConnect

“MobiLink A”

“MobiLink B”

“MobiLink C”


UltraLite for M-Business Anywhere

  • Enables mobile workers anytime, anywhere

  • “Always Available” information

  • Easy to develop

    • HTML, JavaScript, SQL

  • Easy to deploy

    • M-Business Anywhere clients download updated/new applications dynamically

  • Secure from device to enterprise


More Information

  • The newsgroups include the following:

  • ianywhere.public.sqlanywhere.general

  • ianywhere.public.sqlanywhere.linux

  • ianywhere.public.sqlanywhere.mobilink

  • ianywhere.public.sqlanywhere.product_futures_discussion

  • ianywhere.public.sqlanywhere.replication

  • ianywhere.public.sqlanywhere.ultralite

  • ianywhere.public.mbusinessanywhere.general


  • Login