Reference | Help | Introduction | Slide Show | Class Hierarchy | InterClient | ||
PREV | NEXT | FRAMES | NO FRAMES |
Class.forName ("interbase.interclient.Driver"); Connection c = DriverManager.getConnection (url,properties);The Connection object in turn provides access to all of the InterClient classes and methods that allow you to execute SQL statements and get back the results.
jdbc:subprotocol:subnameThe subprotocol names a particular kind of database connection, which is in turn supported by one or more database drivers. The DriverManager decides which driver to use based on which subprotocol is registered for each driver. The contents and syntax of subname in turn depend upon the subprotocol. If the network address is included in the subname, the naming convention for the subname is:
//hostname:/subsubnamesubsubname can have any arbitrary syntax.
jdbc:interbase://server/full_db_path"interbase" is the subprotocol, and server is the hostname of the InterBase server. Full_db_path (i.e., "subsubname") is the full pathname of a database file, including the server's root (/) directory. If the InterBase server is a Windows NT system, you must include the drive name as well. InterClient doesn't support passing any attributes in the URL. For local connections, use:
server = "localhost"
dbURL = "jdbc:interbase://accounts//dbs/orders.gdb"refers to the database "orders.gdb" in the directory "/dbs" on the Unix server "accounts."
The URL
dbURL = "jdbc:interbase://support/C:/dbs/customer.gdb"refers to the database "customer.gdb" in the directory "/dbs" on drive C of the Wings or Win95 or NT server "support."
java.util.Properties properties = new java.util.Properties();Now create the connection arguments. user and password are either literal strings or string variables. They must be the username and password on the InterBase database that you are connecting to:
properties.put ("user", user); properties.put ("password", password);Now create the connection with the URL and connection properties parameters:
Connection c = DriverManager.getConnection(url, properties);
For further details on establishing connections, see FirstExample.java in the InterClient examples directory.
Reference | Help | Introduction | Slide Show | Class Hierarchy | InterClient | ||
PREV | NEXT | FRAMES | NO FRAMES |