RealSQLDriver
The Driver
interface interacts with
the DriverManager
. A client application should not call the methods in
RealSQLDriver
directly, but should call them via the DriverManager
class.
(The javadoc for the DriverManager
class can be found at
http://java.sun.com/products/jdk/1.2/docs/api/java/sql/DriverManager.html
To establish a connection to a Reality database, an
application calls one of the three DriverManager.getConnection()
methods, supplying a unique URL in the
format:
jdbc:realsql://host{:port}/database{;key=value,key=value}
Where:
-
host
is the network name of the remote system. -
port
is the port number of the DDATCP listening port on the remote system. This is optional and if not supplied defaults to 1203. -
database
is the database name defined on the remote system. It can be found in the ROUTE-FILE on Unix or the Registry on Windows systems. -
key=value
may contain the following properties:-
user
is the userid on the remote host and database
-userpwd
is the user password on the remote host and database
-account
is the Reality account where the SQL server will logon
-accountpwd
is the Reality account password, if one exists
-logLevel
defines the level of diagnostic information to be traced
-logOptions
applies additional tracing information if required
-logModules
controls which modules are traced
-hostOption
defines server tracing if required
-HostItemName
sets the item name in the Reality logfileSQLSRVLOG
(for more information on the last five properties, see Diagnostics)
The key=value
pairs are defined as optional,
but a connection will not be successful
without at least a user-id, user password and account name.
The three getConnection()
methods in DriverManager
provide three alternative ways in which the properties can be supplied. The Connection
Examples illustrate the three ways: Method A appends all of the information to
the URL; Method B and the full Example Application
build a java.util.Properties
object to pass the connection properties; Method C appends the account, account
password and a logging property to the URL, then passes the URL, plus separate user and user
password identifiers, to getConnection()
.
The request
is packaged and forwarded to the RealSQLDriver.connect()
method. The connection
URL is parsed and validated and a new Connection
object is created, at which
point the connection to the database is established.