Reference | Help | Introduction | Slide Show | Class Hierarchy | InterClient | ||
PREV | NEXT | FRAMES | NO FRAMES |
There are two common methods for establishing a connection using any JDBC driver:
java.sql.Driver d = new interbase.interclient.Driver (); java.sql.Connection c = d.connect ("jdbc:interbase://server/c:/database-dir/atlas.gdb", "sysdba", "masterkey");or, alternatively
Class.forName ("interbase.interclient.Driver"); java.sql.Connection c = DriverManager.getConnection ("jdbc:interbase://server/c:/database-dir/atlas.gdb", "sysdba", "masterkey");When the Driver class is loaded, an anonymous driver instance is automatically created and registered with the driver manager. The driver manager will locate the driver instance based on the URL prefix "jdbc:interbase:".
Note: Because of a bug in the JDK 1.1.x with Class.forName(). There is a race condition in the class loader, and it is sometimes possible that the class loader is prevented from executing the static section of code in the driver class. This would prevent the loaded driver class from registering itself with the driver manager. So Class.forName () may appear to succeed with no exception thrown, but the driver may not be registered with the driver manager. One work-around is to obtain a connection from an explicitly constructed driver instance as follows:
java.sql.Driver d = new interbase.interclient.Driver (); java.sql.Connection c = d.connect ("jdbc:interbase://server/c:/database-dir/atlas.gdb", "sysdba", "masterkey");
For further details, see the InterClient examples directory for class FirstExample.java
Reference | Help | Introduction | Slide Show | Class Hierarchy | InterClient | ||
PREV | NEXT | FRAMES | NO FRAMES |