Advertisement
Guest User

Untitled

a guest
Feb 14th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3. import java.sql.ResultSet;
  4. import java.sql.SQLException;
  5. import java.sql.Statement;
  6.  
  7. class ConnectionDB {
  8.     private Statement st;
  9.     private ResultSet rs;
  10. public ConnectionDB()
  11. {   try
  12.     {  
  13.         Class.forName("com.mysql.jdbc.Driver");
  14.         Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ensam","root","");
  15.         st=con.createStatement();
  16.        
  17.     }
  18.  
  19.  
  20. // st.executeQuery(Select);
  21.     catch(ClassNotFoundException e)
  22. {
  23.         e.printStackTrace();
  24. }
  25.     catch(SQLException e2)
  26. {
  27.         e2.printStackTrace();
  28. }
  29. }
  30. public Statement getSt() {
  31.     return st;
  32. }
  33. public ResultSet getRs() {
  34.     return rs;
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement