|
|||||||||
| Home >> All >> org >> dinopolis >> gpstool >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.dinopolis.gpstool.util
Class JDBCUtil

java.lang.Objectorg.dinopolis.gpstool.util.JDBCUtil
- public class JDBCUtil
- extends java.lang.Object
This class can be used as an abstraction layer for different sql databases.
- Version:
- $Revision: 1.2 $
| Field Summary | |
(package private) java.sql.Connection |
db_connection_
|
(package private) java.sql.Statement |
db_statement_
|
(package private) boolean |
debug_
|
(package private) java.lang.String |
driver_name_
|
(package private) java.lang.String |
jdbc_url_
|
(package private) java.lang.String |
password_
|
(package private) java.lang.String |
username_
|
| Constructor Summary | |
JDBCUtil(java.lang.String driver_name,
java.lang.String jdbc_url,
java.lang.String username,
java.lang.String password)
Constructs a location marker source that reads from a jdbc connection. |
|
| Method Summary | |
void |
close()
|
java.sql.ResultSet |
executeQuery(java.lang.String sql)
Executes an executeQuery call on the db_statement_ and takes care, that multiple accesses to db_statements_ is handled correctly. |
void |
executeSQL(java.io.Reader sql_reader)
Prints the result of a file containing sql statements. |
void |
executeSQLFile(java.lang.String filename)
Prints the result of a reader containing sql statements. |
int |
executeUpdate(java.lang.String sql)
Executes an executeUpdate call on the db_statement_ and takes care, that multiple accesses to db_statements_ is handled correctly. |
java.util.Vector |
getTables()
Queries the database for all tables. |
static void |
main(java.lang.String[] args)
|
void |
open()
|
void |
optimizeDatabase()
Tries to increase the performance of the database. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String query)
|
void |
printSQLResult(java.lang.String query)
Prints the result of an sql query. |
void |
setDebug(boolean debug)
Set debug to true to print information on stdout. |
boolean |
tableExists(java.lang.String tablename)
Returns true if the given tablename exists. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
driver_name_
java.lang.String driver_name_
jdbc_url_
java.lang.String jdbc_url_
username_
java.lang.String username_
password_
java.lang.String password_
db_connection_
java.sql.Connection db_connection_
db_statement_
java.sql.Statement db_statement_
debug_
boolean debug_
| Constructor Detail |
JDBCUtil
public JDBCUtil(java.lang.String driver_name, java.lang.String jdbc_url, java.lang.String username, java.lang.String password)
- Constructs a location marker source that reads from a jdbc
connection.
| Method Detail |
setDebug
public void setDebug(boolean debug)
- Set debug to true to print information on stdout.
open
public void open()
throws java.lang.ClassNotFoundException,
java.sql.SQLException
close
public void close()
throws java.sql.SQLException
getTables
public java.util.Vector getTables() throws java.sql.SQLException
- Queries the database for all tables.
tableExists
public boolean tableExists(java.lang.String tablename) throws java.sql.SQLException
- Returns true if the given tablename exists. Comparison is case
insensitive!
executeSQLFile
public void executeSQLFile(java.lang.String filename) throws java.sql.SQLException, java.io.FileNotFoundException
- Prints the result of a reader containing sql statements. The '#'
character indicates that the rest of the line is to be taken as a
comment. All sql statements are separated by ';'. An sql statement
may be written in two or more lines.
executeSQL
public void executeSQL(java.io.Reader sql_reader) throws java.sql.SQLException
- Prints the result of a file containing sql statements. The '#'
character indicates that the rest of the line is to be taken as a
comment. All sql statements are separated by ';'. An sql statement
may be written in two or more lines.
optimizeDatabase
public void optimizeDatabase()
throws java.sql.SQLException
- Tries to increase the performance of the database. In case of an
hsqldb database, the sql command "CHECKPOINT" is used, otherwise
nothing is done for the moment.
printSQLResult
public void printSQLResult(java.lang.String query) throws java.sql.SQLException
- Prints the result of an sql query. If the query is a select query,
the resulting ResultSet is printed (with header), otherwise the
number of modified rows are printed.
executeUpdate
public int executeUpdate(java.lang.String sql) throws java.sql.SQLException
- Executes an executeUpdate call on the db_statement_ and takes care,
that multiple accesses to db_statements_ is handled correctly.
executeQuery
public java.sql.ResultSet executeQuery(java.lang.String sql) throws java.sql.SQLException
- Executes an executeQuery call on the db_statement_ and takes care,
that multiple accesses to db_statements_ is handled correctly.
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String query) throws java.sql.SQLException
main
public static void main(java.lang.String[] args)
|
|||||||||
| Home >> All >> org >> dinopolis >> gpstool >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.dinopolis.gpstool.util.JDBCUtil