SQL/MX Programming Manual for Java
SQLJ Programming
HP NonStop SQL/MX Programming Manual for Java—523726-003
3-11
Explicit Connection Contexts
The connection context class also includes these methods for instantiating the
connection context object:
Using the Default Connection Context
The SQLJ run-time environment of SQL/MX provides a default connection context. Use
the getDefaultContext() method of the connection context class to return the
default connection context object. For example, instantiate the connection context ctx
by calling the getDefaultContext() method:
ctx = SQLMXCtx.getDefaultContext();
This approach is the simplest way of establishing an explicit connection context for an
SQLJ program that uses SQL/MX.
For portability, the program should verify that the getDefaultContext() method
does not return null. In SQLJ run-time environments that do not provide a default
connection context, the getDefaultContext() method returns null. If this method
public CtxClassName(String url,
java.util.Properties info,
boolean autoCommit)
throws java.sql.SQLException
Constructs a connection
context object based on a
JDBC URL and sets a
Properties object and
an autocommit setting for
the connection. See Using
JDBC URL Constructors
on page 3-14.
public CtxClassName(String url,
boolean autoCommit)
throws java.sql.SQLException
Constructs a connection
context object based on a
JDBC URL and sets an
autocommit setting for the
connection. See Using
JDBC URL Constructors
on page 3-14.
Method Description
public static CtxClassName getDefaultContext() Returns the default
connection context object
for the class. See Using
the Default Connection
Context on page 3-11.
public static void setDefaultContext
(CtxClassName ctx)
Sets the default connection
context object for the class.
See Setting a JDBC
Connection as the Default
Connection Context on
page 3-12.
Constructor Description