Hey all, All i would like is assistance to connecting to a database with the .odb file extension
private static final String DATABASE_FILE_NAME = "OfMiceAndMen.mdb";
private static final String DRIVER = "jdbc:odbc:DRIVER=" + "{Microsoft Access Driver (*.mdb)};" + "DBQ=" + new File (DATABASE_FILE_NAME).getAbsolutePath () + ";";
static
{
try
{
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch (ClassNotFoundException e)
{
System.out.println ("Class not found");
e.printStackTrace ();
}
}
private Connection dbcon
dbcon = DriverManager.getConnection (DRIVER);
Statement stmt = dbcon.createStatement ();
String sql = "SELECT Cue, lights, sound, projection, stagedir, ID FROM Cues WHERE ID = " + I + " ";
ResultSet rs = stmt.executeQuery (sql);
while (rs.next ())
{
String c = rs.getString ("Cue");
c = c + "";
}
This is the code a friend gave.. Pls help