SQL/MX Programming Manual for Java

SQLJ Programming
HP NonStop SQL/MX Programming Manual for Java523726-003
3-14
Explicit Connection Contexts
Using JDBC URL Constructors
The URL forms of the connection context constructor accept a JDBC URL and other
properties for the connection:
url is a JDBC URL. The JDBC URL for the JDBC/MX driver is jdbc:sqlmx:.
user is the name of a user.
password is a string that represents a password.
autoCommit is a Boolean value that turns the autocommit setting on or off.
info is the name of a Properties object.
SQL/MX accepts but ignores the user and password arguments, which do not apply to
an SQL/MX or SQL/MP database. A NonStop system requires users to be logged in
already before running programs on the system.
Before instantiating the connection context object by using a JDBC URL constructor,
explicitly load the JDBC/MX driver. For more information, see Explicitly Loading the
JDBC/MX Driver on page 3-7.
Instantiate the connection context object by invoking one of the JDBC URL
constructors and by passing the JDBC/MX driver URL, jdbc:sqlmx:, to it:
For example, this JDBC URL constructor instantiates a connection context object
ctx and sets a user name, a password, and an autocommit setting for the
connection:
String url = "jdbc:sqlmx:"
String user = "super.super";
String passwd = "me";
boolean autocmt = true;
ctx new SQLMXCtx(url, user, passwd, autocmt);
This JDBC URL constructor instantiates a connection context object ctx and sets
a Properties object and an autocommit setting for the connection:
String url = "jdbc:sqlmx:"
Properties info = new Properties();
info.setProperty("user", "super.super");
info.setProperty("password", "me");
boolean autocmt = true;
ctx new SQLMXCtx(url, info, autocmt);
This JDBC URL constructor instantiates a connection context object ctx and sets
an autocommit setting for the connection:
String url = "jdbc:sqlmx:"
boolean autocmt = true;
ctx new SQLMXCtx(url, autocmt);
Each instantiation of a connection context object by a JDBC URL constructor results in
a new JDBC connection established for the connection context.