Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import java.sql.Connection; import java.sql.DriverManager; public static Connection getConnection() throws Exception{ try{ String driver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://24.196.52.166:3306/testdb"; String username = "username"; String password = "password"; Class.forName(driver); Connection conn = DriverManager.getConnection(url,username,password); System.out.println("Connected"); return conn; } catch(Exception e){System.out.println(e);} return null; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement