Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. static final String JDBC_DRIVER="com.mysql.jdbc.Driver";
  2. static final String DB_URL="jdbc:mysql://127.0.0.1:3306/LibraryDB";
  3. static final String USER = "root";
  4. static final String PASS = "";
  5.  
  6. public Connection conn;
  7. public ResultSet rs;
  8. public String errorMsg;
  9.  
  10. public void createConnection() {
  11. try {
  12. Class.forName("com.mysql.jdbc.Driver");
  13. conn = DriverManager.getConnection(DB_URL,USER,PASS);
  14. } catch (Exception e) {
  15. Logger.getLogger(DBConnection.class.getName()).log(Level.SEVERE,null,e);
  16. errorMsg= e.toString();
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement