Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String url = "jdbc:mysql://localhost:3306/test"; // test is the db name
- String user = "root";
- String password = "root";
- Connection conn = null;
- PreparedStatement stt;
- ResultSet rs;
- try{
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- conn = DriverManager.getConnection(url, user, password);
- }catch(Exception e){
- JOptionPane.showMessageDialog(null, "Error in establishing connection with database");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement