Advertisement
Guest User

Untitled

a guest
Nov 30th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. package test;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5. import java.sql.SQLException;
  6.  
  7. public class LoadDriver {
  8. public static Connection getConnection(){
  9. try {
  10. Class.forName("com.mysql.jdbc.Driver");
  11. Connection conn = DriverManager.getConnection("jdbc:mysql://dt5.ehb.be/1718OOAJAVA017","1718OOAJAVA017","37692581");
  12. conn.setAutoCommit(false);
  13. return conn;
  14. } catch (SQLException ex) {
  15. // handle any errors
  16. System.out.println("SQLException: " + ex.getMessage());
  17. System.out.println("SQLState: " + ex.getSQLState());
  18. System.out.println("VendorError: " + ex.getErrorCode());
  19. } catch (ClassNotFoundException e) {
  20. e.printStackTrace();
  21. }
  22. return null;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement