A database element allows you to query a back-end database and display the results in an application.
Creating a database element
Log in to Mobile Web Studio and select Build | Applications. Right-click in the detail view and select New Aggregated Application.
When the Application Builder appears, right-click in either frame and select New Database Element from the Element menu. You can also click the down arrow next to Add and select Database Element.
In the Database Element Definition window, select either:
Connection Cache – this option is the default. In ConnCache Name, select the name of the connection cache you want to use from the drop-down list.
Using a connection pool is more efficient than using
the JDBC URL option, which creates a new connection to the database
every time the application executes.
or
JDBC URL – customizes the login or other connection information for specific users. Enter:
Username – enter the user name
used to access the database. The default user name for Adaptive
Server Anywhere is dba
.
Password – enter the password used to access
the database. The default password for the Adaptive Server Anywhere
database is SQL
.
JDBC Connect URL – enter the connection string to access the database; for example:
jdbc:sybase:Tds:localhost:port/portaldatabase
localhost – the name of the installed database server
port – the port used to connect to the specified database
portaldatabase – the name of the database to which you want to connect
If the database server is installed on the same machine
as UA, you do not have to change the “localhost” value.
JDBC Driver – enter the JDBC driver used to access the database; for example:
com.sybase.jdbc2.jdbc.SybDriver
SQL Query String – enter the SQL statement to retrieve the requested data from the database.
When creating a database application with the “like” clause,
for example
where xyz like
and @op
for parameterization,
you must use %
in
the SQL statement.
For example:
select * from gemp where fname like '%@OP["fname"="Ger_t"]%' /*
Click Preview to see the query results.
UI XSLT – (optional) enter the complete URL of the XSLT to be applied to the content returned by the database or click Select to choose from existing XSL templates.
Click Next.
In the Split window, split columns or rows using delimiters. See “Adding split rules”. Click Next.
In the Define window, define the record layout and specify a record header. See “Defining record layout”. Click Next.
In the Filter window, specify filter rules to select only the relevant data from the element. See “Adding filter rules”. Click Next.
This window displays only if you have defined the record layout. The Configure Parameters window displays the element’s CGI parameters. See “CGI parameters” and “Using the database table adapter”. Click Next.
In the New Web Element window, enter a name for the database application in the Element Name field. Click Next.
In the Continuous Capture window, click Finish to close the window and display the Application Builder with the new database element.
Regardless of the element type, the procedure to save the element and application is the same. See “Saving applications”.
See Chapter 9, “Building Pages,” for instructions on adding applications to
pages.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |