DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Open A JDBC Connection
This opens a JDBC connection givine a driver class name, database URL, user name and password. It is possible this method is deprecated and some newer procedure is preferred. I need to look into that.
/*
** driverClass is the JDBC driver class name as a String.
*/
try
{
Class.forName (driverClass);
connection = DriverManager.getConnection (url,
userName, password);
connection.setAutoCommit (false);
}
catch (SQLException ex)
{
/*
** "Connect error"...
*/
}
catch (java.lang.ClassNotFoundException ex)
{
/*
** "Driver error"...
*/
}






Comments
Snippets Manager replied on Wed, 2006/04/26 - 3:32pm
Snippets Manager replied on Mon, 2006/02/27 - 11:12pm