|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrdbms.SqlBean
public class SqlBean
This class provides an implementation some of the methods in the java.sql package. This init method creates the connection to the database and retrieves additional database information. The information is retrieved and contained in the class variables for further accessibility.
Constructor Summary | |
---|---|
SqlBean()
Constructor. |
Method Summary | |
---|---|
void |
close()
Closes the connections to this database. |
java.lang.String |
getCatalogName()
Gets this Connection's current catalog name. |
int |
getColumnCount(java.sql.ResultSetMetaData _rsmd)
Gets the number of columns in a ResultSet. |
java.lang.String[] |
getColumnTypeNames(java.sql.ResultSetMetaData _rsmd)
Gets the database types of the columns in a ResultSet. |
java.lang.String |
getCurrentQuery()
Gets the value of this current SQL. |
java.sql.DatabaseMetaData |
getDatabaseMetaData()
Gets this DataBaseMetaData object. |
java.lang.String |
getDriverName()
Gets the name of this JDBC driver. |
java.lang.String |
getKeyWords()
Gets the keywords associated with this database. |
java.lang.String[] |
getNonMSysTables()
Gets the names of all the Non-System Tables in this Database. |
int |
getNumberofRows(java.util.Vector v)
Returns the size of a vector. |
java.lang.String |
getProductName()
Gets the name of this database product. |
boolean |
getReadOnly()
Gets whether or not this connection to this database is read only. |
java.sql.ResultSet |
getResultSet()
Gets the ResultSet contained in this instance variable rs. |
java.sql.ResultSetMetaData |
getResultSetMetaData(java.sql.ResultSet _rs)
Gets the MetaData for a specified ResultSet. |
java.lang.String[] |
getRowAsString(java.sql.ResultSet _rs)
Converts a row in a ResultSet to a String. |
java.util.Vector |
getRows(java.sql.ResultSet _rs)
Converts a ResultSet to a Vector of Strings. |
java.lang.String[] |
getTableFields(java.sql.ResultSetMetaData _rsmd)
Gets the names of the columns (fields) in a provided ResultSet. |
java.lang.String |
getTableName()
Gets the value of this current table name. |
java.lang.String[] |
getTableNames()
Gets the table names contained in this current database. |
java.sql.ResultSet |
getTableTypes()
Gets the table types available in this database connection. |
boolean |
getUsesLocalFiles()
Gets whether or not this database stores tables in a local file. |
void |
init()
Loads specified driver and initializes the Connection to this Database. |
static void |
main(java.lang.String[] args)
Main entry point for application. |
void |
modifyDatabase(java.lang.String sql)
Process an SQL INSERT, DELETE or UPDATE statement string. |
void |
moveToTop(java.sql.ResultSet _rs)
Moves to the top of this RecordSet. |
boolean |
nextRow(java.sql.ResultSet _rs)
Moves to the next row of a provided ResultSet. |
void |
print(java.sql.ResultSet _rs)
Prints the contents of a provided ResultSet. |
void |
printDataBaseInfo()
Prints information about this database connection. |
void |
println(java.lang.Object o)
Prints the contents of a provided Object. |
void |
println(java.lang.String[] s)
Prints the contents of a String array. |
void |
printResultSetInfo(java.sql.ResultSet _rs)
Prints information about this current ResultSet. |
java.sql.ResultSet |
query(java.lang.String sql)
Creates a Result Set based on an sql query. |
void |
setDriver(java.lang.String _driver)
Sets the name of the instance variable, driver, which this class is loadeding. |
void |
setPassword(java.lang.String _password)
Sets this classes instance variable, password, for this database connection. |
void |
setResultSet(java.lang.String myquery)
Sets this classes resultset instance variable, rs, based on a provided SQL query. |
void |
setTableName(java.lang.String _tablename)
Sets this classes instance variable, tablename, for the current database tablename. |
void |
setUrl(java.lang.String _url)
Sets this classes instance variable, url, for this database url. |
void |
setUserId(java.lang.String _userId)
Sets this classes instance variable, userId, for this database connection. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SqlBean()
Method Detail |
---|
public boolean getUsesLocalFiles()
public boolean getReadOnly()
public java.lang.String getCatalogName()
public java.lang.String getDriverName()
public java.lang.String getProductName()
public java.sql.ResultSet getResultSet()
public java.lang.String getTableName()
public java.lang.String getCurrentQuery()
public java.lang.String[] getTableNames()
public java.lang.String[] getNonMSysTables()
public java.sql.ResultSet getTableTypes()
public void setResultSet(java.lang.String myquery)
myquery
- the SQL querypublic void setUserId(java.lang.String _userId)
_userId
- the database UserIdpublic void setPassword(java.lang.String _password)
_password
- the database Passwordpublic void setUrl(java.lang.String _url)
_url
- the database urlpublic void setDriver(java.lang.String _driver)
_driver
- the driver namepublic void setTableName(java.lang.String _tablename)
_tablename
- the database tablenamepublic void init()
Loads the driver and Connects to the Database *
Retrieves and sets Database/Connection Information as follows: *
  MetaData of this Database *
  Read Only Property *
  Uses
Local Files Property *
  Driver Name Used for
the Connection *
  Database Product Name *
  Table Types in this Database
public void printDataBaseInfo()
Prints
the following information:
  The name of this
database product *
  This Connection's current
catalog name *
  Is this connection in read-only
mode *
  Does this database store tables in a
local files *
  The name of this JDBC driver *
  The SQL keywords of this database *
  The table types of all the tables in this
database *
  The names of all the tables in this
database *
  The names of all the non-system
tables in this database
public void printResultSetInfo(java.sql.ResultSet _rs)
Prints
the following information:
  The column names
(fields) of this database *
  The type name of
the columns (fields) used by this database
_rs
- the current ResultSetpublic void close()
public java.sql.ResultSet query(java.lang.String sql)
sql
- the sql query
public java.sql.ResultSetMetaData getResultSetMetaData(java.sql.ResultSet _rs)
_rs
- the ResultSet
public int getColumnCount(java.sql.ResultSetMetaData _rsmd)
_rsmd
- the ResultSetMetaData
public java.lang.String getKeyWords()
public java.lang.String[] getColumnTypeNames(java.sql.ResultSetMetaData _rsmd)
_rsmd
- the ResultSetMetaData
public java.lang.String[] getRowAsString(java.sql.ResultSet _rs)
_rs
- the ResultSet pointed to a particular row * @return the
contents of the ResultSetpublic java.util.Vector getRows(java.sql.ResultSet _rs)
_rs
- the ResultSet
public int getNumberofRows(java.util.Vector v)
v
- the Vector
public void moveToTop(java.sql.ResultSet _rs)
_rs
- the ResultSetpublic void print(java.sql.ResultSet _rs)
_rs
- the ResultSetpublic void println(java.lang.Object o)
o
- the Objectpublic void println(java.lang.String[] s)
s
- an array of string to be printedpublic boolean nextRow(java.sql.ResultSet _rs)
_rs
- the ResultSetpublic java.lang.String[] getTableFields(java.sql.ResultSetMetaData _rsmd)
_rsmd
- the ResultSetMetaData
public java.sql.DatabaseMetaData getDatabaseMetaData()
public void modifyDatabase(java.lang.String sql)
sql
- the SQL INSERT, UPDATE or DELETE statement or an SQL
statement that returns nothingpublic static void main(java.lang.String[] args)
args
- the command line arguments
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |