Advertisement
Guest User

Untitled

a guest
Jan 11th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. package dao;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5.  
  6. public class DBConnect {
  7.  
  8. public static Connection getConnecttion() {
  9. Connection cons = null;
  10. try {
  11. Class.forName("com.mysql.jdbc.Driver");
  12. cons = DriverManager.getConnection(
  13. "jdbc:mysql://localhost:3306/image-gallery", "root", "");
  14. } catch (Exception e) {
  15. e.printStackTrace();
  16. }
  17. return cons;
  18. }
  19.  
  20. public static void main(String[] args) {
  21. System.out.println(getConnecttion());
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement