JDBC URL Argument

From InterBase
Jump to: navigation, search

iGo Up to Installing InterClient Classes into JBuilder


The JDBC URL argument uses a JDBC application to send in connection, data source and driver properties via the URL. Third party applications can now add run-time parameters to the InterBase JDBC driver and the InterBase server by appending them to the database URL property.

The following examples illustrates how to use the JDBC URL argument for passing additional parameters:

Example:

String url = "jdbc:interbase://localhost:3050/c:/dbs/books.ib?logWriterFile=logfile.txt";

Multiple properties can also be passed as:

Example:

String url = "jdbc:interbase://localhost:3050/c:/dbs/books.ib?logWriterFile=logfile.txt;create=true”;

Legacy methods provide for by the Datasource, and the DriverManager class are still retained and work as before, however, note that the new functionality takes precedence over the Datasource and Drivermanager methods. Consider the following Java code as an example:

{
String url = "jdbc:interbase://localhost:3050/c:/dbs/books.ib?logWriterFile=logfile.txt;create=true”;

dataSource.setServerName ( "localhost");
dataSource.setDatabaseName ( url );
dataSource.setCreateDatabase ( false);
}

In this case, the create database flag in the URL will have precedence.

Advance To: