Using JDBC URLs
Go Up to Installing InterClient Classes into JBuilder
The JDBC URL is the parameter used to locate the actual database to which you want to connect. A JDBC URL can be broken down into three parts, all separated by colons: the keyword jdbc
, the subprotocol name, and the datasource name or location. The jdbc
keyword is needed to distinguish JDBC URLs from other URLs, such as those for HTTP or FTP. The subprotocol name is used to select the proper JDBC driver for the connection. Every JDBC driver has its own subprotocol name to which it responds. InterClient URLs always have a subprotocol of InterBase
. Other JDBC drivers have their own unique subprotocol names, for example, the JDBC-ODBC Bridge answers JDBC URLs with the subprotocol of odbc
.
The third part of an InterClient URL holds the name of the server that is running InterBase and the location of the database to which you want to connect. In the following syntax, “absolute” and “relative” are always with respect to the server, not the client:
On Unix:
jdbc:interbase://servername//absolutePathToDatabase.ib jdbc:interbase://servername/relativePathToDatabase.ib
On Microsoft Windows:
jdbc:interbase://servername//DriveLetter:/absolutePathToDatabase.ib jdbc:interbase://servername/relativePathToDatabase.ib
Here are a few possible configuration options and their corresponding JDBC URLs.
For the atlas
database on a Unix machine named sunbox
you might use something like this (the path on the Unix machine is /usr/databases/atlas.ib
):
jdbc:interbase://sunbox//usr/databases/atlas.ib
To access database test
in directory /inetpub
on a Unix machine named localhost:
jdbc:interbase://localhost//inetpub/test.ib
To access database test
in subdirectory inetpub
on a Unix machine named localhost:
jdbc:interbase://localhost/inetpub/test.ib
To access the jupiter
database on an NT machine named mrbill
, you might use something like this (notice the drive letter):
jdbc:interbase://mrbill/c:/interbas/examples/jupiter.ib
If the client and the server are on the same machine and you wanted to make a local connection, use loopback
as the server name. For example, on Microsoft Windows:
jdbc:interbase://loopback/c:/interbas/examples/jupiter.ib
Other than these connection-specific issues, InterClient can be used like any other JDBC driver with JBuilder. With Local InterBase, JBuilder Professional and Client/Server versions, it makes it easy to develop and test powerful database applications in Java.