Database Class

Object used to represent all of the information required to connect to a database.

Constructors

public Database( )
public Database( String name, String host, int port, String username, String password, javaxt.sql.Driver driver )
public Database( java.sql.Connection conn )
public Database( String connStr )

Methods

clone( ) returns javaxt.sql.Database
displayDbProperties( javaxt.sql.Connection conn ) returns void
getCatalogs( javaxt.sql.Connection conn ) returns String[]
Used to retrieve a list of available databases found on this server.
getConnection( ) returns javaxt.sql.Connection
Used to open a connection to the database. If a connection pool has been initialized (initConnectionPool), then an open connection is returned from the pool. Otherwise, a new connection is created. In either case, the connection must be closed when you are finished with it.
getConnectionPool( ) returns javaxt.sql.ConnectionPool
Returns the connection pool that was created via the initConnectionPool method. Returns null if the connection pool has not been not initialized or if the connection pool has been terminated.
getConnectionPoolDataSource( ) returns javax.sql.ConnectionPoolDataSource
Used to instantiate a ConnectionPoolDataSource for the database. The ConnectionPoolDataSource is typically used to create a JDBC Connection Pool.
getConnectionPoolSize( ) returns int
Returns the size of the connection pool.
getConnectionString( ) returns String
Returns a JDBC connection string used to connect to the database. Username and password are appended to the end of the url.
getDriver( ) returns javaxt.sql.Driver
getHost( ) returns String
Returns the name or IP address of the server or a physical path to the database file.
getName( ) returns String
Gets the name of the catalog used to store tables, views, etc.
getPassword( ) returns String
getPort( ) returns Integer
getProperties( ) returns java.util.Properties
getReservedKeywords( javaxt.sql.Connection conn ) returns String[]
Used to retrieve a list of reserved keywords for a given database.
getTables( javaxt.sql.Connection conn ) returns javaxt.sql.Table[]
Used to retrieve an array of tables found in this database.
getUserName( ) returns String
initConnectionPool( ) returns void
Used to initialize a connection pool. Subsequent called to the getConnection() method will return connections from the pool.
setConnectionPoolDataSource( javax.sql.ConnectionPoolDataSource dataSource ) returns void
Used to set the ConnectionPoolDataSource for the database. Typically, the getConnectionPoolDataSource() method is used to create a ConnectionPoolDataSource. This method allows you to specify a different ConnectionPoolDataSource.
setConnectionPoolSize( int maxConnections ) returns void
Used to specify the size of the connection pool. The pool size must be set before initializing the connection pool. If the pool size is not defined, the connection pool will default to 15.
setDriver( javaxt.sql.Driver driver ) returns void
setDriver( String driver ) returns void
Used to find a driver that corresponds to a given vendor name, class name, or protocol.
setDriver( java.sql.Driver driver ) returns void
setDriver( Class driver ) returns void
setHost( String host ) returns void
Used to set the path to the database.
hostServer name/port (e.g. localhost:9080) or a path to a file (e.g. /temp/firebird.db)
setHost( String host, int port ) returns void
Used to set the path to the database (server name and port).
setName( String name ) returns void
Sets the name of the catalog used to store tables, views, etc.
setPassword( String password ) returns void
setPort( int port ) returns void
setProperties( java.util.Properties properties ) returns void
setUserName( String username ) returns void
terminateConnectionPool( ) returns void
Used to terminate the connection pool, closing all active connections.
toString( ) returns String
Returns database connection information encapsulated by this class.