Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static final String JDBC_DRIVER="com.mysql.jdbc.Driver";
- static final String DB_URL="jdbc:mysql://127.0.0.1:3306/LibraryDB";
- static final String USER = "root";
- static final String PASS = "";
- public Connection conn;
- public ResultSet rs;
- public String errorMsg;
- public void createConnection() {
- try {
- Class.forName("com.mysql.jdbc.Driver");
- conn = DriverManager.getConnection(DB_URL,USER,PASS);
- } catch (Exception e) {
- Logger.getLogger(DBConnection.class.getName()).log(Level.SEVERE,null,e);
- errorMsg= e.toString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement