SHARE
TWEET

Untitled

uopspop Aug 12th, 2016 (edited) 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.sql.*;
  2.  
  3. public class statemetn2 {
  4.  
  5.     public static void main(String[] args) throws Exception{
  6.         // TODO Auto-generated method stub
  7.         String JDBCDrivers = "oracle.jdbc.driver.OracleDriver";
  8.         String useThisDriver_url = "jdbc:oracle:thin:@localhost:1521:xe";
  9.        
  10.         Class.forName(JDBCDrivers);
  11.         Connection con = DriverManager.getConnection(useThisDriver_url,"user08","1111");
  12.         Statement stmt = con.createStatement();
  13.         ResultSet rs = stmt.executeQuery("SELECT * FROM emp2");
  14.         while(rs.next()){
  15.             String col1 = rs.getString(1);
  16.             System.out.println(col1);
  17.         }
  18.         rs.close(); stmt.close(); con.close();
  19.     }
  20.  
  21. }
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