Guest User

Untitled

a guest
May 19th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. import java.sql.*;
  2. public class Learnjdbc {
  3.  
  4. public static String name="root";
  5. public static String password="ismail19972018";
  6. public static String url="jdbc:mysql://localhost/myinfo";
  7. public static void main(String[] args) throws ClassNotFoundException {
  8. Connection connect=null;
  9. Statement stm=null;
  10. PreparedStatement prstm=null;
  11. ResultSet rs=null;
  12.  
  13.  
  14. try{
  15. Class.forName("com.mysql.jdbc.cj.Driver");
  16. connect=DriverManager.getConnection(url,name,password);
  17. System.out.println("connected");
  18.  
  19. }catch(SQLException ex){
  20.  
  21.  
  22.  
  23. ex.printStackTrace();
  24. }
  25. }
Add Comment
Please, Sign In to add comment