Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. import java.sql.*;
  2.  
  3. String driver = "com.mysql.jdbc.Driver"; // MySql driver
  4.  
  5. Class.forName(driver);
  6.  
  7. Connection con=DriverManager.getConnection("jdbc:mysql://localhost/test","root","pass");
  8.  
  9. ResultSet result = null;
  10. String query = "SELECT * FROM client";
  11.  
  12. try {
  13.  
  14. Statement stmt = con.createStatement();
  15. result = stmt.executeQuery(query);
  16.  
  17. } catch (SQLException e) {
  18.  
  19. //if exception is throwe
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement