Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.sqlj.runtime
Class Oracle

    java.lang.Object
      |
      +--oracle.sqlj.runtime.Oracle

public class Oracle
extends java.lang.Object

This class provides concise methods for establishing and installing SQLJ database connections. Two basic methods are provided: "getConnection" and "connect". The "getConnection" method is used to create a new database connection and return a handle to it in the form of connection context instance. The "connect" method is similar to the "getConnection" method in that it creates a new database connection. However, "connect" additionally installs the new connection as the static default context. Moreover, "connect" does not create a new connection if a static default context was previously installed.

The "getConnection" method is used when multiple or explicitly passed connection contexts are required, whereas the "connect" method is used when a single, implictly shared connection context is acceptable.

Both "getConnection" and "connect" exist with a number of different overloaded signatures to meet various connection requirements. The overloadings correspond to the overloadings of the DefaultContext constructors. Additional overloadings are provided which allow connections to be established using property file settings.

A number of method overloadings differ only in the extance or absence of an auto-commit argument. When auto-commit is not explicitly passed, new connections are created with auto-commit turned off. Note that this is different behavior from standard JDBC drivers, which create connections with auto-commit turned on by default.

This class can be used to establish a database connection using the Oracle JDBC drivers. Explicit registration of the Oracle JDBC driver is not required, as registration is performed implicitly when needed. This class can also be used to connect using non-Oracle drivers. In such cases, registration of the required drivers must be performed explicitly by the client.

See Also:
  `DefaultContext`

Field Summary
`static java.lang.String` | `PASSWORD_KEY` The name of the password key within a properties file: "sqlj.password"
`static java.lang.String` | `SQLJ_PROPERTIES` The name of the default properties file: "sqlj.properties"
`static java.lang.String` | `URL_KEY` The name of the url key within a properties file: "sqlj.url"
`static java.lang.String` | `USER_KEY` The name of the user key within a properties file: "sqlj.user"

Constructor Summary
`Oracle()`

Method Summary
`static void` | `close()` Releases all resources used in maintaining database state on the default context: closes any open connected profiles, and closes the underlying jdbc connection.
`static void` | `close(boolean closeConnection)` Releases all resources used in maintaining database state on the default context: closes any open connected profiles, and optionally closes the underlying jdbc connection - since the underlying JDBC connection managed by this context may be shared between mutliple context objects, it is not always desireable to close the underlying JDBC Connection when close is called.
`static DefaultContext` | `connect(java.lang.Class loadCtx, java.lang.String propName)` Creates and installs a new connection context instance as the static default context if one did not previously exist.
`static DefaultContext` | `connect(java.lang.Class loadCtx, java.lang.String propName, boolean autoCommit)` Creates and installs a new connection context instance as the static default context if one did not previously exist.
`static DefaultContext` | `connect(java.lang.Class loadCtx, java.lang.String propName, java.lang.String user, java.lang.String password)` Creates and installs a new connection context instance as the static default context if one did not previously exist.
`static DefaultContext` | `connect(java.lang.Class loadCtx, java.lang.String propName, java.lang.String user, java.lang.String password, boolean autoCommit)` Creates and installs a new connection context instance as the static default context if one did not previously exist.
`static DefaultContext` | `connect(java.sql.Connection conn)` Creates and installs a new connection context instance as the static default context if one did not previously exist.
`static DefaultContext` | `connect(ConnectionContext other)` Creates and installs a new connection context instance as the static default context if one did not previously exist.
`static DefaultContext` | `connect(java.lang.String url)` Creates and installs a new connection context instance as the static default context if one did not previously exist.
`static DefaultContext` | `connect(java.lang.String url, boolean autoCommit)` Creates and installs a new connection context instance as the static default context if one did not previously exist.
`static DefaultContext` | `connect(java.lang.String url, java.util.Properties info)` Creates and installs a new connection context instance as the static default context if one did not previously exist.
`static DefaultContext` | `connect(java.lang.String url, java.util.Properties info, boolean autoCommit)` Creates and installs a new connection context instance as the static default context if one did not previously exist.
`static DefaultContext` | `connect(java.lang.String url, java.lang.String user, java.lang.String password)` Creates and installs a new connection context instance as the static default context if one did not previously exist.
`static DefaultContext` | `connect(java.lang.String url, java.lang.String user, java.lang.String password, boolean autoCommit)` Creates and installs a new connection context instance as the static default context if one did not previously exist.
`static DefaultContext` | `getConnection(java.lang.Class loadCtx, java.lang.String propName)` Returns a new default context instance whose underlying connection is created based on the "sqlj.url", "sqlj.user", and "sqlj.password" entries of a property file.
`static DefaultContext` | `getConnection(java.lang.Class loadCtx, java.lang.String propName, boolean autoCommit)` Returns a new default context instance whose underlying connection is created based on the "sqlj.url", "sqlj.user", and "sqlj.password" entries of a property file and the passed auto-commit mode.
`static DefaultContext` | `getConnection(java.lang.Class loadCtx, java.lang.String propName, java.lang.String user, java.lang.String password)` Returns a new default context instance whose underlying connection is created based on the "sqlj.url" entry of a property file, and the passed user and password.
`static DefaultContext` | `getConnection(java.lang.Class loadCtx, java.lang.String propName, java.lang.String user, java.lang.String password, boolean autoCommit)` Returns a new default context instance whose underlying connection is created based on the "sqlj.url" entry of a property file, and the passed user, password and auto-commit mode.
`static DefaultContext` | `getConnection(java.sql.Connection conn)` Returns a new default context instance which uses the passed connection as its underlying connection.
`static DefaultContext` | `getConnection(ConnectionContext other)` Returns a new default context instance which uses the same underlying connection as the passed connection context instance.
`static DefaultContext` | `getConnection(java.lang.String url)` Returns a new default context instance whose underlying connection is created based on the passed url.
`static DefaultContext` | `getConnection(java.lang.String url, boolean autoCommit)` Returns a new default context instance whose underlying connection is created based on the passed url and auto-commit mode.
`static DefaultContext` | `getConnection(java.lang.String url, java.util.Properties info)` Returns a new default context instance whose underlying connection is created based on the passed url and properties information.
`static DefaultContext` | `getConnection(java.lang.String url, java.util.Properties info, boolean autoCommit)` Returns a new default context instance whose underlying connection is created based on the passed url, properties information, and auto-commit mode.
`static DefaultContext` | `getConnection(java.lang.String url, java.lang.String user, java.lang.String password)` Returns a new default context instance whose underlying connection is created based on the passed url, user, and password.
`static DefaultContext` | `getConnection(java.lang.String url, java.lang.String user, java.lang.String password, boolean autoCommit)` Returns a new default context instance whose underlying connection is created based on the passed url, user, password and auto-commit mode.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### SQLJ_PROPERTIES

    public static final java.lang.String SQLJ_PROPERTIES

  The name of the default properties file: "sqlj.properties"

### USER_KEY

    public static final java.lang.String USER_KEY

  The name of the user key within a properties file: "sqlj.user"

### PASSWORD_KEY

    public static final java.lang.String PASSWORD_KEY

  The name of the password key within a properties file: "sqlj.password"

### URL_KEY

    public static final java.lang.String URL_KEY

  The name of the url key within a properties file: "sqlj.url"

Constructor Detail

### Oracle

    public Oracle()

Method Detail

### connect

    public static DefaultContext connect(java.sql.Connection conn)
                                  throws java.sql.SQLException

  Creates and installs a new connection context instance as the static default context if one did not previously exist. If a static default context already exists when this method is called, then this method does nothing and returns null. Otherwise, a new connection context instance is created via the "getConnection" method with corresponding parameters, installed as the static default context, and returned as the result of this method.

  Most clients will ignore the return value of this method.

  Parameters:
    `conn` - the underlying connection for the context instance.
  Throws:
    java.sql.SQLException - if a new instance could not be created
  See Also:
    `DefaultContext.setDefaultContext(sqlj.runtime.ref.DefaultContext)`, `DefaultContext.getDefaultContext()`, `getConnection(java.sql.Connection)`

### connect

    public static DefaultContext connect(java.lang.String url,
                                         java.lang.String user,
                                         java.lang.String password,
                                         boolean autoCommit)
                                  throws java.sql.SQLException

  Creates and installs a new connection context instance as the static default context if one did not previously exist. If a static default context already exists when this method is called, then this method does nothing and returns null. Otherwise, a new connection context instance is created via the "getConnection" method with corresponding parameters, installed as the static default context, and returned as the result of this method.

  Most clients will ignore the return value of this method.

  Parameters:
    `url` - the database url
    `user` - the username
    `password` - the user password
    `autoCommit` - true if the connection should be created in auto-commit mode, false otherwise
  Throws:
    java.sql.SQLException - the database connection could not be created.
  See Also:
    `DefaultContext.setDefaultContext(sqlj.runtime.ref.DefaultContext)`, `DefaultContext.getDefaultContext()`, `getConnection(String, String, String, boolean)`

### connect

    public static DefaultContext connect(java.lang.String url,
                                         java.lang.String user,
                                         java.lang.String password)
                                  throws java.sql.SQLException

  Creates and installs a new connection context instance as the static default context if one did not previously exist. If a static default context already exists when this method is called, then this method does nothing and returns null. Otherwise, a new connection context instance is created via the "getConnection" method with corresponding parameters, installed as the static default context, and returned as the result of this method.

  Most clients will ignore the return value of this method.

  Parameters:
    `url` - the database url
    `user` - the username
    `password` - the user password
  Throws:
    java.sql.SQLException - the database connection could not be created.
  See Also:
    `DefaultContext.setDefaultContext(sqlj.runtime.ref.DefaultContext)`, `DefaultContext.getDefaultContext()`, `getConnection(String,String,String)`

### connect

    public static DefaultContext connect(java.lang.String url,
                                         java.util.Properties info,
                                         boolean autoCommit)
                                  throws java.sql.SQLException

  Creates and installs a new connection context instance as the static default context if one did not previously exist. If a static default context already exists when this method is called, then this method does nothing and returns null. Otherwise, a new connection context instance is created via the "getConnection" method with corresponding parameters, installed as the static default context, and returned as the result of this method.

  Most clients will ignore the return value of this method.

  Parameters:
    `url` - the database url
    `info` - a list of properties for the connection
    `autoCommit` - true if the connection should be created in auto-commit mode, false otherwise
  Throws:
    java.sql.SQLException - the database connection could not be created.
  See Also:
    `DefaultContext.setDefaultContext(sqlj.runtime.ref.DefaultContext)`, `DefaultContext.getDefaultContext()`, `getConnection(String, java.util.Properties, boolean)`

### connect

    public static DefaultContext connect(java.lang.String url,
                                         java.util.Properties info)
                                  throws java.sql.SQLException

  Creates and installs a new connection context instance as the static default context if one did not previously exist. If a static default context already exists when this method is called, then this method does nothing and returns null. Otherwise, a new connection context instance is created via the "getConnection" method with corresponding parameters, installed as the static default context, and returned as the result of this method.

  Most clients will ignore the return value of this method.

  Parameters:
    `url` - the database url
    `info` - a list of properties for the connection
  Throws:
    java.sql.SQLException - the database connection could not be created.
  See Also:
    `DefaultContext.setDefaultContext(sqlj.runtime.ref.DefaultContext)`, `DefaultContext.getDefaultContext()`, `getConnection(String,java.util.Properties)`

### connect

    public static DefaultContext connect(java.lang.String url,
                                         boolean autoCommit)
                                  throws java.sql.SQLException

  Creates and installs a new connection context instance as the static default context if one did not previously exist. If a static default context already exists when this method is called, then this method does nothing and returns null. Otherwise, a new connection context instance is created via the "getConnection" method with corresponding parameters, installed as the static default context, and returned as the result of this method.

  Most clients will ignore the return value of this method.

  Parameters:
    `url` - the database url
    `autoCommit` - true if the connection should be created in auto-commit mode, false otherwise
  Throws:
    java.sql.SQLException - the database connection could not be created.
  See Also:
    `DefaultContext.setDefaultContext(sqlj.runtime.ref.DefaultContext)`, `DefaultContext.getDefaultContext()`, `getConnection(String, boolean)`

### connect

    public static DefaultContext connect(java.lang.String url)
                                  throws java.sql.SQLException

  Creates and installs a new connection context instance as the static default context if one did not previously exist. If a static default context already exists when this method is called, then this method does nothing and returns null. Otherwise, a new connection context instance is created via the "getConnection" method with corresponding parameters, installed as the static default context, and returned as the result of this method.

  Most clients will ignore the return value of this method.

  Parameters:
    `url` - the database url
  Throws:
    java.sql.SQLException - the database connection could not be created.
  See Also:
    `DefaultContext.setDefaultContext(sqlj.runtime.ref.DefaultContext)`, `DefaultContext.getDefaultContext()`, `getConnection(String)`

### connect

    public static DefaultContext connect(ConnectionContext other)
                                  throws java.sql.SQLException

  Creates and installs a new connection context instance as the static default context if one did not previously exist. If a static default context already exists when this method is called, then this method does nothing and returns null. Otherwise, a new connection context instance is created via the "getConnection" method with corresponding parameters, installed as the static default context, and returned as the result of this method.

  Most clients will ignore the return value of this method.

  Parameters:
    `other` - the context with which to share an underlying connection.
  Throws:
    java.sql.SQLException - if an instance could not be constructed
  See Also:
    `DefaultContext.setDefaultContext(sqlj.runtime.ref.DefaultContext)`, `DefaultContext.getDefaultContext()`, `getConnection(sqlj.runtime.ConnectionContext)`

### connect

    public static DefaultContext connect(java.lang.Class loadCtx,
                                         java.lang.String propName,
                                         boolean autoCommit)
                                  throws java.sql.SQLException

  Creates and installs a new connection context instance as the static default context if one did not previously exist. If a static default context already exists when this method is called, then this method does nothing and returns null. Otherwise, a new connection context instance is created via the "getConnection" method with corresponding parameters, installed as the static default context, and returned as the result of this method.

  Most clients will ignore the return value of this method.

  Parameters:
    `loadCtx` - the class used to load the properties file
    `propName` - the name of the properties file to load
    `autoCommit` - true if the connection should be created in auto-commit mode, false otherwise
  Throws:
    java.sql.SQLException - the database connection could not be created or the properties file could not be loaded.
  See Also:
    `DefaultContext.setDefaultContext(sqlj.runtime.ref.DefaultContext)`, `DefaultContext.getDefaultContext()`, `getConnection(Class, String, boolean)`

### connect

    public static DefaultContext connect(java.lang.Class loadCtx,
                                         java.lang.String propName)
                                  throws java.sql.SQLException

  Creates and installs a new connection context instance as the static default context if one did not previously exist. If a static default context already exists when this method is called, then this method does nothing and returns null. Otherwise, a new connection context instance is created via the "getConnection" method with corresponding parameters, installed as the static default context, and returned as the result of this method.

  Most clients will ignore the return value of this method.

  Parameters:
    `loadCtx` - the class used to load the properties file
    `propName` - the name of the properties file to load
  Throws:
    java.sql.SQLException - the database connection could not be created or the properties file could not be loaded.
  See Also:
    `DefaultContext.setDefaultContext(sqlj.runtime.ref.DefaultContext)`, `DefaultContext.getDefaultContext()`, `getConnection(Class, String)`

### connect

    public static DefaultContext connect(java.lang.Class loadCtx,
                                         java.lang.String propName,
                                         java.lang.String user,
                                         java.lang.String password,
                                         boolean autoCommit)
                                  throws java.sql.SQLException

  Creates and installs a new connection context instance as the static default context if one did not previously exist. If a static default context already exists when this method is called, then this method does nothing and returns null. Otherwise, a new connection context instance is created via the "getConnection" method with corresponding parameters, installed as the static default context, and returned as the result of this method.

  Most clients will ignore the return value of this method.

  Parameters:
    `loadCtx` - the class used to load the properties file
    `propName` - the name of the properties file to load
    `user` - the username
    `password` - the user password
    `autoCommit` - true if the connection should be created in auto-commit mode, false otherwise
  Throws:
    java.sql.SQLException - the database connection could not be created or the properties file could not be loaded.
  See Also:
    `DefaultContext.setDefaultContext(sqlj.runtime.ref.DefaultContext)`, `DefaultContext.getDefaultContext()`, `getConnection(Class, String, String, String, boolean)`

### connect

    public static DefaultContext connect(java.lang.Class loadCtx,
                                         java.lang.String propName,
                                         java.lang.String user,
                                         java.lang.String password)
                                  throws java.sql.SQLException

  Creates and installs a new connection context instance as the static default context if one did not previously exist. If a static default context already exists when this method is called, then this method does nothing and returns null. Otherwise, a new connection context instance is created via the "getConnection" method with corresponding parameters, installed as the static default context, and returned as the result of this method.

  Most clients will ignore the return value of this method.

  Parameters:
    `loadCtx` - the class used to load the properties file
    `propName` - the name of the properties file to load
    `user` - the username
    `password` - the user password
  Throws:
    java.sql.SQLException - the database connection could not be created or the properties file could not be loaded.
  See Also:
    `DefaultContext.setDefaultContext(sqlj.runtime.ref.DefaultContext)`, `DefaultContext.getDefaultContext()`, `getConnection(Class, String, String, String)`

### close

    public static void close()
                      throws java.sql.SQLException

  Releases all resources used in maintaining database state on the default context: closes any open connected profiles, and closes the underlying jdbc connection. This method is equivalent to `Oracle.close(CLOSE_CONNECTION)`. The default connection context is also set to null, permitting a subsequent `Oracle.connect()` call to succeed.
  Note: when running inside of JServer, the underlying jdbc connection (which is the default connection of the session) is not closed.
  Throws:
    java.sql.SQLException - if an error occurs when closing the default context.
  See Also:
    `ConnectionContextImpl.close()`, `close(boolean)`

### close

    public static void close(boolean closeConnection)
                      throws java.sql.SQLException

  Releases all resources used in maintaining database state on the default context: closes any open connected profiles, and optionally closes the underlying jdbc connection - since the underlying JDBC connection managed by this context may be shared between mutliple context objects, it is not always desireable to close the underlying JDBC Connection when close is called. The default connection context is also set to null, permitting a subsequent `Oracle.connect()` call to succeed.
  Note: when running inside of JServer, the underlying jdbc connection (which is the default connection of the session) is never closed.
  Parameters:
    `closeConnection` - specify CLOSE_CONNECTION if the underlying JDBC connection is to be closed and KEEP_CONNECTION if it is to be kept open.
  Throws:
    java.sql.SQLException - if an error occurs when closing the default context.
  See Also:
    `ConnectionContext.CLOSE_CONNECTION`, `ConnectionContext.KEEP_CONNECTION`, `ConnectionContextImpl.close(boolean)`, `close()`

### getConnection

    public static DefaultContext getConnection(java.sql.Connection conn)
                                        throws java.sql.SQLException

  Returns a new default context instance which uses the passed connection as its underlying connection. The auto-commit mode of the connection is unchanged.

  Notes:

  - Successful return from this method is neither affected by nor affects the static default context setting.
  - The passed connection will not be closed if this method raises an exception.
  Parameters:
    `conn` - the underlying connection for the context instance.
  Throws:
    java.sql.SQLException - if an instance could not be created

### getConnection

    public static DefaultContext getConnection(java.lang.String url,
                                               java.lang.String user,
                                               java.lang.String password,
                                               boolean autoCommit)
                                        throws java.sql.SQLException

  Returns a new default context instance whose underlying connection is created based on the passed url, user, password and auto-commit mode.

  Notes:

  - Successful return from this method is neither affected by nor affects the static default context setting.
  - If an exception is raised by this method, the underlying connection created during this call is automatically closed.
  Parameters:
    `url` - the database url
    `user` - the username
    `password` - the user password
    `autoCommit` - true if the connection should be created in auto-commit mode, false otherwise
  Throws:
    java.sql.SQLException - the database connection could not be created.

### getConnection

    public static DefaultContext getConnection(java.lang.String url,
                                               java.lang.String user,
                                               java.lang.String password)
                                        throws java.sql.SQLException

  Returns a new default context instance whose underlying connection is created based on the passed url, user, and password. The connection is created with auto-commit off.

  Notes:

  - Successful return from this method is neither affected by nor affects the static default context setting.
  - If an exception is raised by this method, the underlying connection created during this call is automatically closed.
  Parameters:
    `url` - the database url
    `user` - the username
    `password` - the user password
  Throws:
    java.sql.SQLException - the database connection could not be created.
  See Also:
    `getConnection(String,String,String,boolean)`

### getConnection

    public static DefaultContext getConnection(java.lang.String url,
                                               java.util.Properties info,
                                               boolean autoCommit)
                                        throws java.sql.SQLException

  Returns a new default context instance whose underlying connection is created based on the passed url, properties information, and auto-commit mode.

  Notes:

  - Successful return from this method is neither affected by nor affects the static default context setting.
  - If an exception is raised by this method, the underlying connection created during this call is automatically closed.
  Parameters:
    `url` - the database url
    `info` - a list of properties for the connection
    `autoCommit` - true if the connection should be created in auto-commit mode, false otherwise
  Throws:
    java.sql.SQLException - the database connection could not be created.

### getConnection

    public static DefaultContext getConnection(java.lang.String url,
                                               java.util.Properties info)
                                        throws java.sql.SQLException

  Returns a new default context instance whose underlying connection is created based on the passed url and properties information. The connection is created with auto-commit off.

  Notes:

  - Successful return from this method is neither affected by nor affects the static default context setting.
  - If an exception is raised by this method, the underlying connection created during this call is automatically closed.
  Parameters:
    `url` - the database url
    `info` - a list of properties for the connection
  Throws:
    java.sql.SQLException - the database connection could not be created.
  See Also:
    `getConnection(String,java.util.Properties,boolean)`

### getConnection

    public static DefaultContext getConnection(java.lang.String url,
                                               boolean autoCommit)
                                        throws java.sql.SQLException

  Returns a new default context instance whose underlying connection is created based on the passed url and auto-commit mode.

  Notes:

  - Successful return from this method is neither affected by nor affects the static default context setting.
  - If an exception is raised by this method, the underlying connection created during this call is automatically closed.
  Parameters:
    `url` - the database url
    `autoCommit` - true if the connection should be created in auto-commit mode, false otherwise
  Throws:
    java.sql.SQLException - the database connection could not be created.

### getConnection

    public static DefaultContext getConnection(java.lang.String url)
                                        throws java.sql.SQLException

  Returns a new default context instance whose underlying connection is created based on the passed url. The connection is created with auto-commit off.

  Notes:

  - Successful return from this method is neither affected by nor affects the static default context setting.
  - If an exception is raised by this method, the underlying connection created during this call is automatically closed.
  Parameters:
    `url` - the database url
  Throws:
    java.sql.SQLException - the database connection could not be created.
  See Also:
    `getConnection(String,boolean)`

### getConnection

    public static DefaultContext getConnection(ConnectionContext other)
                                        throws java.sql.SQLException

  Returns a new default context instance which uses the same underlying connection as the passed connection context instance. The auto commit mode of the shared connection is used unchanged.

  Notes:

  - Successful return from this method is neither affected by nor affects the static default context setting.
  - The passed other ConnectionContext (and its underlying connection) will not be closed if this method raises an exception.
  Parameters:
    `other` - the context with which to share an underlying connection.
  Throws:
    java.sql.SQLException - if an instance could not be constructed

### getConnection

    public static DefaultContext getConnection(java.lang.Class loadCtx,
                                               java.lang.String propName,
                                               boolean autoCommit)
                                        throws java.sql.SQLException

  Returns a new default context instance whose underlying connection is created based on the "sqlj.url", "sqlj.user", and "sqlj.password" entries of a property file and the passed auto-commit mode.

  The property file is loaded as a resource file using the class loader of the passed "loadCtx" class. If the class loader of the passed class is null, then the file is loaded as a system resource.

  The name of the property file to use is determined by "propName". If "propName" is null, then the name "sqlj.properties" is used. If the "propName" name starts with "/", it is used as is. Otherwise, the name of the package of "loadCtx" is prepended, after converting "." to "/". These naming conventions mirror those defined by Class.getResourceAsStream().

  Notes:

  - Successful return from this method is neither affected by nor affects the static default context setting.
  - If an exception is raised by this method, the underlying connection created during this call is automatically closed.
  Parameters:
    `loadCtx` - the class used to load the properties file
    `propName` - the name of the properties file to load
    `autoCommit` - true if the connection should be created in auto-commit mode, false otherwise
  Throws:
    java.sql.SQLException - the database connection could not be created or the properties file could not be loaded.
  See Also:
    `Class.getResourceAsStream(java.lang.String)`, `SQLJ_PROPERTIES`, `USER_KEY`, `URL_KEY`, `PASSWORD_KEY`

### getConnection

    public static DefaultContext getConnection(java.lang.Class loadCtx,
                                               java.lang.String propName)
                                        throws java.sql.SQLException

  Returns a new default context instance whose underlying connection is created based on the "sqlj.url", "sqlj.user", and "sqlj.password" entries of a property file. The connection is created with auto-commit off.

  The property file is loaded as a resource file using the class loader of the passed "loadCtx" class. If the class loader of the passed class is null, then the file is loaded as a system resource.

  The name of the property file to use is determined by "propName". If "propName" is null, then the name "sqlj.properties" is used. If the "propName" name starts with "/", it is used as is. Otherwise, the name of the package of "loadCtx" is prepended, after converting "." to "/". These naming conventions mirror those defined by Class.getResourceAsStream().

  Notes:

  - Successful return from this method is neither affected by nor affects the static default context setting.
  - If an exception is raised by this method, the underlying connection created during this call is automatically closed.
  Parameters:
    `loadCtx` - the class used to load the properties file
    `propName` - the name of the properties file to load
  Throws:
    java.sql.SQLException - the database connection could not be created or the properties file could not be loaded.
  See Also:
    `Class.getResourceAsStream(java.lang.String)`, `SQLJ_PROPERTIES`, `USER_KEY`, `URL_KEY`, `PASSWORD_KEY`, `getConnection(Class, String, boolean)`

### getConnection

    public static DefaultContext getConnection(java.lang.Class loadCtx,
                                               java.lang.String propName,
                                               java.lang.String user,
                                               java.lang.String password,
                                               boolean autoCommit)
                                        throws java.sql.SQLException

  Returns a new default context instance whose underlying connection is created based on the "sqlj.url" entry of a property file, and the passed user, password and auto-commit mode.

  The property file is loaded as a resource file using the class loader of the passed "loadCtx" class. If the class loader of the passed class is null, then the file is loaded as a system resource.

  The name of the property file to use is determined by "propName". If "propName" is null, then the name "sqlj.properties" is used. If the "propName" name starts with "/", it is used as is. Otherwise, the name of the package of "loadCtx" is prepended, after converting "." to "/". These naming conventions mirror those defined by Class.getResourceAsStream().

  Notes:

  - Successful return from this method is neither affected by nor affects the static default context setting.
  - If an exception is raised by this method, the underlying connection created during this call is automatically closed.
  Parameters:
    `loadCtx` - the class used to load the properties file
    `propName` - the name of the properties file to load
    `user` - the username
    `password` - the user password
    `autoCommit` - true if the connection should be created in auto-commit mode, false otherwise
  Throws:
    java.sql.SQLException - the database connection could not be created or the properties file could not be loaded.
  See Also:
    `Class.getResourceAsStream(java.lang.String)`, `SQLJ_PROPERTIES`, `USER_KEY`, `URL_KEY`, `PASSWORD_KEY`

### getConnection

    public static DefaultContext getConnection(java.lang.Class loadCtx,
                                               java.lang.String propName,
                                               java.lang.String user,
                                               java.lang.String password)
                                        throws java.sql.SQLException

  Returns a new default context instance whose underlying connection is created based on the "sqlj.url" entry of a property file, and the passed user and password. The connection is created with auto-commit off.

  The property file is loaded as a resource file using the class loader of the passed "loadCtx" class. If the class loader of the passed class is null, then the file is loaded as a system resource.

  The name of the property file to use is determined by "propName". If "propName" is null, then the name "sqlj.properties" is used. If the "propName" name starts with "/", it is used as is. Otherwise, the name of the package of "loadCtx" is prepended, after converting "." to "/". These naming conventions mirror those defined by Class.getResourceAsStream().

  Notes:

  - Successful return from this method is neither affected by nor affects the static default context setting.
  - If an exception is raised by this method, the underlying connection created during this call is automatically closed.
  Parameters:
    `loadCtx` - the class used to load the properties file
    `propName` - the name of the properties file to load
    `user` - the username
    `password` - the user password
  Throws:
    java.sql.SQLException - the database connection could not be created or the properties file could not be loaded.
  See Also:
    `Class.getResourceAsStream(java.lang.String)`, `SQLJ_PROPERTIES`, `USER_KEY`, `URL_KEY`, `PASSWORD_KEY`, `getConnection(Class, String, String, String, boolean)`

Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD