Created
April 9, 2011 13:02
-
-
Save Mahkul/911382 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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