Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.0 » UltraLiteJ » UltraLiteJ Reference » UltraLiteJ API reference

 

Connection interface

Describes a database connection, which is required to initiate database operations.

Syntax
public Connection
Remarks

A connection is obtained using the connect or createDatabase methods of the DatabaseManager class. Use the release method when the connection is no longer needed. When all connections for a database are released, the database is closed.

index_schema = table_schema.createPrimaryIndex("primary");
index_schema.addColumn("num", IndexSchema.ASCENDING);

table_schema = conn.createTable("T2");
table_schema.createColumn("num", Domain.INTEGER);
table_schema.createColumn("quantity", Domain.INTEGER);

index_schema = table_schema.createPrimaryIndex("primary");
index_schema.addColumn("num", IndexSchema.ASCENDING);
index_schema = table_schema.createIndex("index1");
index_schema.addColumn("quantity", IndexSchema.ASCENDING);

conn.createPublication("PubA", new String[] {"T1"});
conn.schemaCreateComplete();

A connection provides the following capabilities:

  • create new schema (tables, indexes and publications)
  • create new value and domain objects
  • permanently commit changes to the database
  • prepare SQL statements for execution
  • roll back uncommited changes to the database
  • checkpoint (update the underlying persistent store with committed changes, rather than just storing the change transactions) the database.

The following example demonstrates how to create a schema for a simple database. The database contains a table named T1, which has a single integer primary key column named num, and a table named T2, which has an integer primary key column named num and an integer column named quantity. T2 has an addition index on quantity. A publication named PubA contains T1.

TableSchema table_schema;
 IndexSchema index_schema;
 table_schema = conn.createTable("T1");
 table_schema.createColumn("num", Domain.INTEGER);
Members

All members of Connection, including all inherited members.


CONNECTED variable
NOT_CONNECTED variable
OPTION_DATABASE_ID variable
OPTION_DATE_FORMAT variable
OPTION_DATE_ORDER variable
OPTION_ML_REMOTE_ID variable
OPTION_NEAREST_CENTURY variable
OPTION_PRECISION variable
OPTION_SCALE variable
OPTION_TIMESTAMP_FORMAT variable
OPTION_TIMESTAMP_INCREMENT variable
OPTION_TIME_FORMAT variable
PROPERTY_DATABASE_NAME variable
PROPERTY_PAGE_SIZE variable
SYNC_ALL variable
SYNC_ALL_DB_PUB_NAME variable
SYNC_ALL_PUBS variable
checkpoint function
commit function
createDecimalNumber function
createDecimalNumber function
createDomain function
createDomain function
createDomain function
createForeignKey function
createPublication function
createSyncParms function
createSyncParms function
createTable function
createUUIDValue function
createValue function
disableSynchronization function
dropDatabase function
dropForeignKey function
dropPublication function
dropTable function
emergencyShutdown function
enableSynchronization function
getDatabaseId function
getDatabaseInfo function
getDatabasePartitionSize function
getDatabaseProperty function
getLastDownloadTime function
getOption function
getState function
prepareStatement function
release function
renameTable function
resetLastDownloadTime function
rollback function
schemaCreateBegin function
schemaCreateComplete function
setDatabaseId function
setOption function
startSynchronizationDelete function
stopSynchronizationDelete function
synchronize function
truncateTable function