Advertisement
Guest User

getconnection per mik

a guest
Jan 9th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. public static Connection getConnection(){
  2.        
  3.         Connection conn=null;
  4.        
  5.         try {
  6.             Class.forName("com.mysql.jdbc.Driver");
  7.         } catch (ClassNotFoundException ex) {
  8.             Logger.getLogger(DBconnect.class.getName()).log(Level.SEVERE, null, ex);
  9.         }
  10.         String dburl="jdbc:mysql://localhost/log15tecweb";
  11.         try {
  12.             conn=DriverManager.getConnection(dburl,"root","QWEasd65");
  13.         } catch (SQLException ex) {
  14.             Logger.getLogger(DBconnect.class.getName()).log(Level.SEVERE, null, ex);
  15.         }
  16.        
  17.        return conn;
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement