JDBC Connection Wrapper Class
This project is no longer maintained
|Tired with wrapping all your JDBC calls in Try.. Catch statements? Fed up with long winded database connection code?|
Welcome to the first opensource release of DBConnection.
com.webprofusion.utli.db.DBConnection is a simple wrapper object for JDBC database connections and currently supports MySQL & MS SQL Server. Also included in this package are the classes com.webprofusion.utils.StringUtils and com.webprofusion.SiteProperties - The dbconnection object currently uses this class to load settings for the DB Connection at runtime (this lets you define a properties file which specifies the dbengine and connection info.
An Example usage of the DBConnection object would be:
DBConnection conn=new DBConnection();
conn.open(); //do this before you use a new DBConnection..
into DiscussionMessages values ("+StringUtils.inQuotes(myname)+","+StringUtils.inQuotes(message)+","+conn.getCurrentDateSQL()+")";
conn.close(); //always do this when finished using the DBConnection
conn = new DBConnection();
String sql="select name from Users";
conn.openQueryRS(sql); //use this to open your query results
//loop through results (if any)
//always close result set
You can perform any number of DBConnection.executeUpdate("...") or
as long as you don't nest another operation inside an openQueryRS/closeQueryRS, if you need to nest a query, create a new DBConnection to handle it.
Webprofusion Ltd 2000