Connecting to an UltraLite database

UltraLite applications must connect to a database before carrying out operations on the data in it.

Here is the simplest way to establish a connection. Extensions to this technique are given in the following sections.

var DatabaseMgr;
var Connection;
DatabaseMgr = CreateObject("iAnywhere.UltraLite.DatabaseManager.CustDB");
Connection = DatabaseMgr.openConnection("dbf=" + DatabaseMgr.directory + "\\mydb.udb");
Using the Connection object

The following properties of the Connection object govern global application behavior.

For more information about the Connection object, see Connection class.

  • Commit behavior   By default, UltraLite applications are in autoCommit mode. Each insert, update, or delete statement is committed to the database immediately. Set Connection.autoCommit to false to build transactions into your application. Turning autoCommit off and performing commits directly can improve the performance of your application. See commit method.

  • User authentication   You can change the user ID and password for the application from the default values of DBA and sql by using the grantConnectTo and revokeConnectFrom methods. See Authenticating users.

  • Synchronization   A set of objects governing synchronization are accessed from the Connection object. See Synchronizing data.

  • Tables   UltraLite tables are accessed using the Connection.getTable method. See getTable method.