Guest User

Untitled

a guest
Mar 27th, 2019
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3. import java.sql.ResultSet;
  4. import com.oracle.*;
  5. import java.sql.*;
  6.  
  7.  
  8. import java.sql.Statement;
  9.  
  10. import java.util.*;
  11. public class xyz
  12. {
  13. public static void main(String args[])
  14. {
  15. try
  16. {
  17. Class.forName("com.mysql.jdbc.Driver");
  18. Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","SUKH","123");
  19.  
  20. Statement stmt=con.createStatement();
  21. ResultSet rs=stmt.executeQuery("select * from student");
  22. while(rs.next())
  23. System.out.println(rs.getString(1)+" "+rs.getString(2)+" "+rs.getString(3));
  24. con.close();
  25. }
  26. catch(Exception e)
  27. {
  28. System.out.println(e);
  29. }
  30. }
  31. }
Add Comment
Please, Sign In to add comment