SHARE
TWEET

Untitled

a guest Apr 2nd, 2019 29 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.sql.*;
  2. public class test {
  3.     public static void main(String[] args) {
  4.         try{
  5.             String url="jdbc:oracle:thin:@localhost:1521:xe";
  6.             String user="test";
  7.             String pass="123";
  8.             Class.forName("oracle.jdbc.driver.OracleDriver");
  9.             Connection con= DriverManager.getConnection(url, user, pass);
  10.             Statement stmt=con.createStatement();
  11.             ResultSet rs=stmt.executeQuery("select * from student");
  12.             while(rs.next())
  13.                     {
  14.                 System.out.print(rs.getString(1)+" "+rs.getString(2)+" "+rs.getString(3));
  15.                     }
  16.            
  17.         }
  18.         catch (Exception e) {
  19.             System.out.print(e);
  20.             // TODO: handle exception
  21.         }
  22.     }
  23.  
  24. }
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