How to use ORACLE Thin Driver for JDBC Connectivity

Showing Answers 1 - 1 of 1 Answers

Hema

  • Aug 23rd, 2006
 

This is from orqfaq.comimport java.sql.*;class dbAccess { public static void main (String args []) throws SQLException { DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver()); Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@hostname:1526:orcl", "scott", "tiger"); // @machineName:port:SID, userid, password Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION"); while (rset.next()) System.out.println (rset.getString(1)); // Print col 1 stmt.close(); }}

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions