Advertisement
Guest User

Untitled

a guest
Aug 6th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. package database;
  2.  
  3. import java.sql.*;
  4. import java.util.logging.Level;
  5. import java.util.logging.Logger;
  6.  
  7. public class Db_Connection
  8.  
  9. {
  10. public void main (String[] args){
  11. Connection cnx= Connection();
  12. }
  13. public Connection Connection()
  14. {
  15. try
  16. {
  17.  
  18.  
  19. Class.forName("com.mysql.jdbc.Driver");
  20. String techworld3g = "jdbc:mysql://localhost:3306/techworld3g?user=root";
  21. Connection myConnection = DriverManager.getConnection(techworld3g);
  22.  
  23. return myConnection;
  24.  
  25. } catch (ClassNotFoundException | SQLException ex) {Logger.getLogger(Db_Connection.class.getName()).log(Level.SEVERE, null, ex);}
  26. return null;
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement