Guest User

Untitled

a guest
Oct 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3. import java.sql.PreparedStatement;
  4. import java.sql.ResultSet;
  5. import java.sql.SQLException;
  6. import java.sql.Statement;
  7.  
  8.  
  9. public class TryThree {
  10.  
  11. public static void main(String args[]) throws SQLException{
  12.  
  13. Connection con = DriverManager.getConnection ("jdbc:mysql://67.20.123.248:3306/whitebu4_sliditerod" ,"whitebu4_admins" , "admins1234");
  14. String dbClass = "com.mysql.jdbc.Driver";
  15. Statement statement = con.createStatement();
  16. String query = "Select x,y,z FROM xyz";
  17. ResultSet result = statement.executeQuery(query);
  18.  
  19. result.getFloat ("Nome");
  20. result.getFloat ("Nome");
  21. result.getFloat ("Nome");
  22. result.getString ("Nome");
  23.  
  24.  
  25.  
  26. try {
  27.  
  28. Class.forName("com.mysql.jdbc.Driver");
  29.  
  30. Statement st = con.createStatement();
  31.  
  32. while(result.next()){
  33.  
  34.  
  35. System.out.print(result);
  36. System.out.print(result);
  37. System.out.print(result);
  38.  
  39. } //end while
  40.  
  41. con.close();
  42. } //end try
  43.  
  44. catch(ClassNotFoundException e) {
  45. e.printStackTrace();
  46. }
  47.  
  48. catch(SQLException e) {
  49. e.printStackTrace();
  50. }
  51.  
  52. } //end main
  53.  
  54. } //end class
Add Comment
Please, Sign In to add comment