daily pastebin goal
38%
SHARE
TWEET

Untitled

a guest May 22nd, 2018 105 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.sql.DriverManager;
  2. import java.sql.PreparedStatement;
  3. import java.sql.ResultSet;
  4.  
  5.  
  6. public class testing{
  7.    
  8. public static void main(String[] args) throws Exception
  9. {
  10.  
  11. Class.forName("com.mysql.jdbc.Driver");
  12.  
  13. java.sql.Connection con= DriverManager.getConnection("jdbc:mysql://localhost/projectjava","interview","password");
  14.  
  15. PreparedStatement statement = con.prepareStatement("select * from names");
  16.  
  17. ResultSet result = statement.executeQuery();
  18.  
  19. while (result.next())
  20. {
  21.  
  22. System.out.println("<html>" +
  23. "<head><title>Books</title></head>" +
  24. "<body>" +
  25. "Hi" +
  26. "</body>" +
  27. "</html>");
  28.  
  29. System.out.println(result.getString(1) + " " + result.getString(2));
  30.  
  31. }
  32. }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top