|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.alicebot.server.sql.pool.DbAccess
public class DbAccess
Represents all connection details to a DBMS and allows for getting the input/output streams.
Uses JDBC so as to support any DBMS with a JDBS driver. For use with another DBMS one should change the classname for the Java Driver and the specific URL.
Sample:
driver class name : "oracle.jdbc.dnlddriver.OracleDriver" specific URL : "dbc:oracle:dnldthin:@ora.doxa.ro:1526:ORCL".
Field Summary | |
---|---|
protected java.sql.Connection |
connection
The Connection used by this object. |
protected java.lang.String |
driver
The name of the driver used by this object. |
protected java.lang.String |
password
The password used by this object. |
protected java.sql.Statement |
statement
The statement used by this object. |
protected java.lang.String |
url
The URL string used by this object. |
protected java.lang.String |
user
The user name used by this object. |
Constructor Summary | |
---|---|
DbAccess(java.sql.Connection connection)
Constructs a DbAccess object
given a Connection object. |
|
DbAccess(java.lang.String driver,
java.lang.String url,
java.lang.String user,
java.lang.String password)
Constructs a DbAccess object given
a driver, url, user name and password. |
Method Summary | |
---|---|
void |
connect()
Connects to the database using the values of the fields already set in this object. |
java.sql.ResultSet |
executeQuery(java.lang.String query)
Returns the ResultSet
from executing a given query. |
int |
executeUpdate(java.lang.String update)
Returns the ResultSet
from executing a given update. |
java.sql.Connection |
getConnection()
Returns the Connection
object used by this object. |
java.lang.String |
getDriver()
Returns the name of the driver used by this object. |
java.lang.String |
getPassword()
Returns the password used by this object. |
java.sql.Statement |
getStatement()
Returns the Statement
object used by this object. |
java.lang.String |
getUrl()
Returns the URL string used by this object. |
java.lang.String |
getUser()
Returns the user name used by this object. |
void |
setConnection(java.sql.Connection connection)
Sets the Connection
object used by this object. |
void |
setDriver(java.lang.String driver)
Sets the name of the driver to be used by this object. |
void |
setPassword(java.lang.String password)
Sets the password to be used by this object. |
void |
setUrl(java.lang.String url)
Sets the URL string to be used by this object. |
void |
setUser(java.lang.String user)
Sets the user name to be used by this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.sql.Connection connection
protected java.sql.Statement statement
protected java.lang.String driver
protected java.lang.String url
protected java.lang.String user
protected java.lang.String password
Constructor Detail |
---|
public DbAccess(java.lang.String driver, java.lang.String url, java.lang.String user, java.lang.String password)
DbAccess
object given
a driver, url, user name and password.
driver
- name of the class representing the Driver to be used by the Driver managerurl
- location of a data source name (dsn)user
- user namepassword
- password for userpublic DbAccess(java.sql.Connection connection)
DbAccess
object
given a Connection
object.
connection
- the Connection
object
from which to construct the DbAccess
objectMethod Detail |
---|
public void connect()
java.sql.SQLException
- if the connection cannot be made
java.lang.ClassNotFoundException
- if the driver class cannot be foundpublic java.sql.ResultSet executeQuery(java.lang.String query) throws java.sql.SQLException
ResultSet
from executing a given query.
query
- the query to execute
ResultSet
from executing a given query
java.sql.SQLException
- if there was a problem.public int executeUpdate(java.lang.String update)
ResultSet
from executing a given update.
update
- the update to execute
public java.sql.Connection getConnection()
Connection
object used by this object.
public java.lang.String getDriver()
public java.lang.String getPassword()
public java.sql.Statement getStatement()
Statement
object used by this object.
public java.lang.String getUrl()
public java.lang.String getUser()
public void setConnection(java.sql.Connection connection)
Connection
object used by this object.
connection
- the Connection object to be usedpublic void setDriver(java.lang.String driver)
driver
- the name of the driver to be usedpublic void setPassword(java.lang.String password)
password
- the password to be usedpublic void setUrl(java.lang.String url)
url
- the URL string to be usedpublic void setUser(java.lang.String user)
user
- the user name to be used
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |