Oracle® Database Lite Administration and Deployment Guide Release 10.3 Part Number E12089-02 |
|
|
View PDF |
When you are connecting to the back-end Oracle database or to the client, you will use the JDBC driver. The following sections describe the syntax for the client Oracle Lite database and for the back-end Oracle database:
Section 2.2, "Creating and Managing the Database for a Mobile Client"
Section 2.4, "Enabling Client/Server for Multiple Users to Access Single Entry Point for Database"
The full description of what the Oracle Lite database is and does is described in Section 1.1, "Oracle Lite Database Overview" in the Oracle Database Lite Client Guide The following describes how the Oracle Lite database integrates with the Mobile Server.
You can use the Oracle Lite database either with the Mobile client and use synchronization to replicate data between the client and the Oracle database or you can embed the Oracle Lite database within an independent application of your own design. Either way, you use a small database that contains the client data—known as the Oracle Lite database. Most of the data is stored in a file with an ODB extension; any BLOB objects—either binary or character—and the indexes are stored in a file with an OBS extension. The Oracle Lite database exists solely to store and retrieve the user data specific to this device. It is not a replication of the entire Oracle database.
Oracle Database Lite creates all ODB and OBS files with an automatic name and assigns a data source name (DSN). The DSN is used to connect to the database using ODBC, JDBC or ADO.NET APIs. In order to make the connection, you must know the DSN name for your ODB file. When you install the Mobile Development Kit, a default database is installed with database name of polite.odb
and DSN name of polite
. However, when you synchronize, an Oracle Lite database is created for each publication (under a directory named after each user). For details on the name and location of the Oracle Lite database, see Section 6.3, "Synchronizing or Executing Applications On The Mobile Client" in the Oracle Database Lite Client Guide This describes the functions of each of the tabs at the top of the Mobile Workspace. The DSN for these ODB files is a combination of the username followed by the ODB name.
When you use the Mobile client and Mobile Server to replicate data between the back-end Oracle database and your Mobile device, a small Oracle Lite database (ODB file) is created on your Mobile device to contain the data—that is stored in tables known as snapshots. The snapshot tables are used to track the modifications that the client makes on the data, which is then replicated during the synchronization process to the back-end database. All of this activity is transparent to the client. Your application queries and modifies data using SQL as if interacting with any Oracle database.
The Oracle Lite database for the Mobile client is automatically created on the first synchronization request. In addition, the data is replicated and updated with the data on the Oracle database automatically for you. See Section 2.3, "What is the Process for Setting Up a User for Synchronization?" in the Oracle Database Lite Developer's Guide for techniques that can be used to create publication items on the Mobile Server, which then automatically creates snapshots on the client when you synchronize with the database.
Note:
For details on the name and location of the Oracle Lite database for the Mobile client, see see Section 6.3, "Synchronizing or Executing Applications On The Mobile Client" in the Oracle Database Lite Client Guide.The following sections describe how to connect to the Oracle Lite database on the client or to the back-end Oracle database:
Connect to the file-based Oracle Lite starter database using your application or mSQL, which is a command line interface. By default, when you are using the Mobile Server product, the default DSN and database name are both POLITE
.
If you installed the Oracle Lite database as part of the Mobile Server, then the default ODBC DSN is POLITE
and database name is POLITE
. To connect to the POLITE
database using mSQL with SYSTEM
user, MANAGER
password, and the POLITE
data source name, perform the following:
C:>msql system/manager@jdbc:polite:polite
For full details on how to connect to the client Oracle Lite database, see Section 2.4, Connecting to the Oracle Lite Database" in the Oracle Database Lite Client Guide.
When connecting to the repository in the back-end Oracle database, you provide a URL to locate the database. Use the Thin JDBC driver to connect to the back-end Oracle Database. With the Thin JDBC driver, you can either provide the host, port and SID or the Oracle Net address or tnsnames entry.
The syntax for providing the host, port and SID is as follows:
jdbc:oracle:thin:@<hostname>:<port>:<sid>
For example, the following JDBC URL for the thin JDBC driver connects to my-pc.us.oracle.com
on port 1521 with SID of orcl
:
jdbc:oracle:thin:@my-pc.us.oracle.com:1521:orcl
The syntax for using an Oracle Net address or tnsnames entry is as follows:
jdbc:oracle:thin:@oracle-net-address-or-tnsnames-entry
For example, the following JDBC URL for the thin JDBC driver connects to the webtogo.world
tnsnames entry:
jdbc:oracle:thin:@webtogo.world
Alternatively, you could provide the full Oracle Net address, as follows:
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP) (HOST=my-pc.us.oracle.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=mypc)))
If the Mobile repository is installed in an Oracle RAC database, then provide the JDBC URL for an Oracle RAC database, which can have more than one address for multiple Oracle databases in the cluster. The following is the URL structure for an Oracle RAC database address:
jdbc:oracle:thin:@(DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=PRIMARY_NODE_HOSTNAME)(PORT=1521)) (ADDRESS=(PROTOCOL=TCP)(HOST=SECONDARY_NODE_HOSTNAME)(PORT=1521)) ) (CONNECT_DATA=(SERVICE_NAME=DATABASE_SERVICENAME)))
If you want to have multiple users accessing a single entry point for the Oracle Lite database, then use one of the following multi-user services:
For multiple clients accessing a single Mobile client that synchronizes with a Mobile Server, use the Branch Office service. See Chapter 8, "Manage Your Branch Office" for full details.
For multiple clients executing an application that accesses the same database, set up a listener to receive requests from each of these clients. See Chapter 3, "Building a Client/Server Environment" in the Oracle Database Lite Client Guide for full details.