Guest User

Untitled

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