헤르메스 LIFE

[Source] A test of the Thin driver for an application 본문

Core Java

[Source] A test of the Thin driver for an application

헤르메스의날개 2011. 11. 7. 18:58
728x90
import java.sql.*;
class TestThinApp {
public static void main (String args[])
throws ClassNotFoundException, SQLException {
Class.forName("oracle.jdbc.driver.OracleDriver");
// or you can use:
// DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@dssnt01:1521:dssora01","scott","tiger");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery(
"select 'Hello Thin driver tester '||USER||'!' result from dual");
while(rset.next()) System.out.println(rset.getString(1));
rset.close( );
stmt.close( );
conn.close( );
}
}
728x90