Java Reference
In-Depth Information
String array of column names pertinent to the query, rather than all the column names for the entire
table.
Listing 7-5: DatabaseUtilities
package jdbc_bible.part2;
import java.awt.event.*;
import java.sql.*;
import java.util.Vector;
import sun.jdbc.odbc.JdbcOdbcDriver;
public class DatabaseUtilities{
static String jdbcDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
static String dbName = "Contacts";
static String urlRoot = "jdbc:odbc:";
private ActionListener exceptionListener = null;
public DatabaseUtilities(){
registerDriver();
}
public void setDatabaseName(String dbName){
this.dbName=dbName;
}
public void registerDriver(){
try {
Class.forName(jdbcDriver);
DriverManager.registerDriver(new JdbcOdbcDriver());
}
catch(ClassNotFoundException e){
reportException(e.getMessage());
}
catch(SQLException e){
reportException(e.getMessage());
}
Search WWH ::




Custom Search