    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

##

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

##

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

##

NsDb

     public NsDb() throws SQLException

  Create a new Database connection. A database handle is obtained automatically.

  Throws: SQLException
    if a database access error occurred

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

##

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

pools

     public native String[] pools()

  Return a list of the poolnames that are available.

  Returns:
    a list of available pools.

getPointer

     public String getPointer()

  Get the reference to the stored database handle.

  Returns:
    Reference to tcl database handle.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

disconnect

     public void disconnect()

  Method for disconnecting associated handle.

flush

     public void flush() throws SQLException

  Method for flushing the associated handle.

  Throws: SQLException
    if a database access error occurred

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

releasehandle

     public void releasehandle() throws SQLException

  Method for releasing the database handle.

  Throws: SQLException
    if a database access error occurred

resethandle

     public Integer resethandle() throws SQLException

  Method for resetting the database handle.

  Throws: SQLException
    if a database access error occurred

cancel

     public void cancel() throws SQLException

  Method for cancelling the current operation.

  Throws: SQLException
    if a database access error occurred

connected

     public boolean connected()

  Method to test if the connection is made.

sp_exec

     public String sp_exec() throws SQLException

  Method to exec stored procedures.

  Throws: SQLException
    if a database access error occurred

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.

sp_getparams

     public String sp_getparams() throws NoSuchMethodException

  Method which currently throws an exception if used.

  Throws: NoSuchMethodException
    Method is not implemented yet.

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

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

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

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

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

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.

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.

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

verbose

     public boolean verbose(boolean state)

  Method which sets verbose mode to on/off.

  Parameters:
    state - verbose mode to use.
  Returns:
    the selected mode.

verbose

     public boolean verbose()

  Method which gets the current verbose mode.

  Returns:
    the selected mode.

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.

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