Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. import java.sql.*;
  2.  
  3. class Connector {
  4.     public static void main(String args[]) {
  5.         try {
  6.            
  7.             Class.forName("com.mysql.jdbc.Driver");
  8.             Connection con = DriverManager.getConnection("jdbc:mysql://a2plcpnl0797.prod.iad2.secureserver.net:3306/HelperQueue", "HelperQueueRoot", "HelperQueueRoot");
  9.             // here sonoo is database name, root is username and password
  10.             Statement stmt = con.createStatement();
  11.             ResultSet rs = stmt.executeQuery("select * FROM  `CourseProducers`");
  12.            
  13.             while (rs.next())
  14.                 System.out.println(rs.getString(2) + "  " + rs.getString(3));
  15.             con.close();
  16.         } catch (Exception e) {
  17.             System.out.println(e);
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement