All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class nsjava.NsDb

java.lang.Object
   |
   +----nsjava.NsDb

public class NsDb
extends Object

NsDb provides a java wrapper around the aolserver db api. The interface is similar to the tcl db interface except that the db handle is maintained in the NsDb object.

See Also:
NsLog, NsPg, NsSet, NsTcl

Constructor Index

 o NsDb()
Create a new Database connection.
 o NsDb(String)
Create a new Database connection.

Method Index

 o bindrow()
Method for binding the results of an exec statements..
 o cancel()
Method for cancelling the current operation.
 o connected()
Method to test if the connection is made.
 o datasource()
Method for obtaining the datasource associated with the db handle.
 o dbtype()
Method for obtaining the dbtype associated with the db handle.
 o disconnect()
Method for disconnecting associated handle.
 o dml(String)
Method which performs dml operations.
 o driver()
Method for obtaining the driver associated with the db handle.
 o exception()
Method for obtaining the last db exception message.
 o exec(String)
Method which performs exec operation.
 o finalize()
End a database connection - release the handle.
 o flush()
Method for flushing the associated handle.
 o gethandle()
Method for obtaining a handle from the default pool.
 o gethandle(int)
Method for obtaining a handle from the default pool with a timeout specified.
 o gethandle(int, String)
Method for obtaining a handle from the named pool with a timeout specified.
 o gethandle(int, String, int)
Method for obtaining a db handle.
 o gethandle(Integer)
Method for obtaining a handle from the default pool with a timeout specified.
 o gethandle(Integer, String)
Method for obtaining a handle from the named pool with a timeout specified.
 o gethandle(Integer, String, int)
Method for obtaining a db handle.
 o gethandle(String)
Method for obtaining a handle from the named pool.
 o getPointer()
Get the reference to the stored database handle.
 o getrow(NsSet)
Method which gets the next result row and places in the referenced NsSet object.
 o interpretsqlfile(String)
Method which is not yet implemented.
 o password()
Method for obtaining the password associated with the db handle.
 o poolname()
Method for obtaining the poolname associated with the db handle.
 o pools()
Return a list of the poolnames that are available.
 o releasehandle()
Method for releasing the database handle.
 o resethandle()
Method for resetting the database handle.
 o select(String)
Method which performs select operation.
 o select_0or1row(String)
Method which performs 0or1row operation.
 o select_1row(String)
Method which performs 1row operation.
 o setexception(String)
Method which is not yet implemented.
 o sp_exec()
Method to exec stored procedures.
 o sp_getparams()
Method which currently throws an exception if used.
 o sp_returncode()
Method to get the stored procedure returncode.
 o sp_setparam(String)
Method which is not yet implemented.
 o sp_start(String)
Method which is not yet implemented.
 o user()
Method for obtaining the user associated with the db handle.
 o verbose()
Method which gets the current verbose mode.
 o verbose(boolean)
Method which sets verbose mode to on/off.

Constructors

 o NsDb
 public NsDb() throws SQLException
Create a new Database connection. A database handle is obtained automatically.

Throws: SQLException
if a database access error occurred
 o NsDb
 public NsDb(String poolname) throws SQLException
Create a new Database connection. A database handle is obtained automatically.

Parameters:
poolname - Grab the handle from the specified pool.
Throws: SQLException
if a database access error occurred

Methods

 o finalize
 public void finalize() throws SQLException
End a database connection - release the handle.

Throws: SQLException
if a database access error occurred
Overrides:
finalize in class Object
 o pools
 public native String[] pools()
Return a list of the poolnames that are available.

Returns:
a list of available pools.
 o getPointer
 public String getPointer()
Get the reference to the stored database handle.

Returns:
Reference to tcl database handle.
 o gethandle
 public String gethandle() throws SQLException
Method for obtaining a handle from the default pool.

Returns:
Reference to tcl database handle.
Throws: SQLException
if a database access error occurred
 o gethandle
 public String gethandle(int timeout) throws SQLException
Method for obtaining a handle from the default pool with a timeout specified.

Parameters:
timeout - timeout in seconds
Returns:
Reference to tcl database handle.
Throws: SQLException
if a database access error occurred
 o gethandle
 public String gethandle(Integer timeout) throws SQLException
Method for obtaining a handle from the default pool with a timeout specified.

Parameters:
timeout - timeout in seconds
Returns:
Reference to tcl database handle.
Throws: SQLException
if a database access error occurred
 o gethandle
 public String gethandle(int timeout,
                         String poolname) throws SQLException
Method for obtaining a handle from the named pool with a timeout specified.

Parameters:
timeout - timeout in seconds
poolname - poolname to use when getting the handle.
Returns:
Reference to tcl database handle.
Throws: SQLException
if a database access error occurred
 o gethandle
 public String gethandle(Integer timeout,
                         String poolname) throws SQLException
Method for obtaining a handle from the named pool with a timeout specified.

Parameters:
timeout - timeout in seconds
poolname - poolname to use when getting the handle.
Returns:
Reference to tcl database handle.
Throws: SQLException
if a database access error occurred
 o gethandle
 public String gethandle(String poolname) throws SQLException
Method for obtaining a handle from the named pool.

Parameters:
poolname - poolname to use when getting the handle.
Returns:
Reference to tcl database handle.
Throws: SQLException
if a database access error occurred
 o gethandle
 public String gethandle(int timeout,
                         String poolname,
                         int nhands) throws SQLException
Method for obtaining a db handle.

Parameters:
timeout - timeout in seconds
poolname - poolname to use when getting the handle.
nhands - the number of handles to get. Currently, the getting of more than one handle is not supported. This will change in the future so that more than one handle can be obtained.
Returns:
Reference to tcl database handle.
Throws: SQLException
if a database access error occurred
 o gethandle
 public String gethandle(Integer timeout,
                         String poolname,
                         int nhands) throws SQLException
Method for obtaining a db handle.

Parameters:
timeout - timeout in seconds
poolname - poolname to use when getting the handle.
nhands - the number of handles to get. Currently, the getting of more than one handle is not supported. This will change in the future so that more than one handle can be obtained.
Returns:
Reference to tcl database handle.
Throws: SQLException
if a database access error occurred
 o exception
 public String exception() throws SQLException
Method for obtaining the last db exception message.

Returns:
Exception message.
Throws: SQLException
if a database access error occurred
 o poolname
 public String poolname() throws SQLException
Method for obtaining the poolname associated with the db handle.

Returns:
Exception message.
Throws: SQLException
if a database access error occurred
 o password
 public String password() throws SQLException
Method for obtaining the password associated with the db handle.

Returns:
the password.
Throws: SQLException
if a database access error occurred
 o user
 public String user() throws SQLException
Method for obtaining the user associated with the db handle.

Returns:
the user.
Throws: SQLException
if a database access error occurred
 o dbtype
 public String dbtype() throws SQLException
Method for obtaining the dbtype associated with the db handle.

Returns:
the dbtype.
Throws: SQLException
if a database access error occurred
 o driver
 public String driver() throws SQLException
Method for obtaining the driver associated with the db handle.

Returns:
the driver.
Throws: SQLException
if a database access error occurred
 o datasource
 public String datasource() throws SQLException
Method for obtaining the datasource associated with the db handle.

Returns:
the datasource.
Throws: SQLException
if a database access error occurred
 o disconnect
 public void disconnect()
Method for disconnecting associated handle.

 o flush
 public void flush() throws SQLException
Method for flushing the associated handle.

Throws: SQLException
if a database access error occurred
 o bindrow
 public NsSet bindrow() throws SQLException
Method for binding the results of an exec statements..

Returns:
the NsSet object.
Throws: SQLException
if a database access error occurred
 o releasehandle
 public void releasehandle() throws SQLException
Method for releasing the database handle.

Throws: SQLException
if a database access error occurred
 o resethandle
 public Integer resethandle() throws SQLException
Method for resetting the database handle.

Throws: SQLException
if a database access error occurred
 o cancel
 public void cancel() throws SQLException
Method for cancelling the current operation.

Throws: SQLException
if a database access error occurred
 o connected
 public boolean connected()
Method to test if the connection is made.

 o sp_exec
 public String sp_exec() throws SQLException
Method to exec stored procedures.

Throws: SQLException
if a database access error occurred
 o sp_returncode
 public String sp_returncode() throws NoSuchMethodException
Method to get the stored procedure returncode.

Returns:
the return code.
Throws: NoSuchMethodException
Method is not implemented yet.
 o sp_getparams
 public String sp_getparams() throws NoSuchMethodException
Method which currently throws an exception if used.

Throws: NoSuchMethodException
Method is not implemented yet.
 o dml
 public void dml(String sql) throws SQLException
Method which performs dml operations.

Parameters:
sql - sql for dml statement.
Throws: SQLException
if a database access error occurred
 o select_0or1row
 public NsSet select_0or1row(String sql) throws SQLException
Method which performs 0or1row operation.

Parameters:
sql - sql for select statement.
Returns:
NsSet object from select operation.
Throws: SQLException
if a database access error occurred
 o select_1row
 public NsSet select_1row(String sql) throws SQLException
Method which performs 1row operation.

Parameters:
sql - sql for select statement.
Returns:
NsSet object from select operation.
Throws: SQLException
if a database access error occurred
 o select
 public NsSet select(String sql) throws SQLException
Method which performs select operation.

Parameters:
sql - sql for select statement.
Returns:
NsSet object from select operation.
Throws: SQLException
if a database access error occurred
 o exec
 public String exec(String sql) throws SQLException
Method which performs exec operation.

Parameters:
jsql - sql for select statement.
Returns:
NS_ROW or NS_DML
Throws: SQLException
if a database access error occurred
 o interpretsqlfile
 public String interpretsqlfile(String sql) throws NoSuchMethodException
Method which is not yet implemented.

Parameters:
jsql - sql for select statement.
Throws: NoSuchMethodException
if this method is called.
 o sp_start
 public String sp_start(String sql) throws NoSuchMethodException
Method which is not yet implemented.

Parameters:
sql - sql for select statement.
Throws: NoSuchMethodException
if this method is called.
 o getrow
 public boolean getrow(NsSet set) throws SQLException
Method which gets the next result row and places in the referenced NsSet object.

Parameters:
set - NsSet object obtained by a previous select.
Throws: SQLException
if a database access error occurred
 o verbose
 public boolean verbose(boolean state)
Method which sets verbose mode to on/off.

Parameters:
state - verbose mode to use.
Returns:
the selected mode.
 o verbose
 public boolean verbose()
Method which gets the current verbose mode.

Returns:
the selected mode.
 o setexception
 public String setexception(String sql) throws NoSuchMethodException
Method which is not yet implemented.

Parameters:
sql - sql for select statement.
Throws: NoSuchMethodException
if this method is called.
 o sp_setparam
 public String sp_setparam(String sql) throws NoSuchMethodException
Method which is not yet implemented.

Parameters:
sql - sql for select statement.
Throws: NoSuchMethodException
if this method is called.

All Packages  Class Hierarchy  This Package  Previous  Next  Index