Created
June 10, 2012 14:29
-
-
Save cx20/2905921 to your computer and use it in GitHub Desktop.
Hello, JDBC Type1 World! (Java + JDBC Type1 + ODBC + Oracle)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.sql.*; | |
import sun.jdbc.odbc.*; | |
class Hello | |
{ | |
public static void main( String[] args ) throws Exception { | |
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); | |
Connection conn = DriverManager.getConnection("jdbc:odbc:HELLODSN", "scott", "tiger"); | |
Statement stmt = conn.createStatement(); | |
ResultSet rs = stmt.executeQuery("SELECT 'Hello, JDBC Type1 World!' AS Message FROM DUAL"); | |
while ( rs.next() ) { | |
System.out.println( rs.getString(1) ); | |
} | |
rs.close(); | |
stmt.close(); | |
conn.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment