Skip to content

Instantly share code, notes, and snippets.

@Mahkul
Created April 9, 2011 13:02
Show Gist options
  • Save Mahkul/911382 to your computer and use it in GitHub Desktop.
Save Mahkul/911382 to your computer and use it in GitHub Desktop.
package database;
import java.sql.*;
public class BookDatabase {
private String user = "";
private String password = "";
static String url = "jdbc:odbc:Books";
static Connection link;
static Statement statement;
static ResultSet results;
public BookDatabase() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
link = DriverManager.getConnection(url, user, password);
statement = link.createStatement();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment