Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- // The newInstance() call is a work around for some
- // broken Java implementations
- Class.forName("com.mysql.cj.jdbc.Driver");
- } catch (Exception ex) {
- // handle the error
- }
- //Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
- Connection conn = null;
- try {
- conn =
- DriverManager.getConnection("jdbc:mysql://localhost/pippo?" +
- "user=root&password=password");
- // Do something with the Connection
- } catch (SQLException ex) {
- // handle any errors
- System.out.println("SQLException: " + ex.getMessage());
- System.out.println("SQLState: " + ex.getSQLState());
- System.out.println("VendorError: " + ex.getErrorCode());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement