Advertisement
Guest User

Untitled

a guest
Jul 8th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import java.sql.*;
  2.  
  3. class Mysqll{
  4. public static void main(String args[]){
  5. try{
  6. Class.forName("com.mysql.jdbc.Driver");
  7. Connection con = DriverManager.getConnection("jdbc::mysql://localhost:3306/asd","root","qwerty");
  8. Statement st = con.createStatement();
  9.  
  10. ResultSet rs = st.executeQuery("select * from abc");
  11.  
  12. while(rs.next())
  13. {
  14. System.out.println(rs.getInt(1) + " " + rs.getString(2));
  15. }
  16. con.close();
  17. }
  18. catch(Exception e)
  19. {
  20. System.out.println(e);
  21. }
  22. }
  23. }
  24.  
  25. java.sql.SQLException: No suitable driver found for jdbc::mysql://localhost:3306/asd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement