Skip to content

Instantly share code, notes, and snippets.

@cx20
Created June 10, 2012 14:29
Show Gist options
  • Select an option

  • Save cx20/2905921 to your computer and use it in GitHub Desktop.

Select an option

Save cx20/2905921 to your computer and use it in GitHub Desktop.

Revisions

  1. cx20 created this gist Jun 10, 2012.
    18 changes: 18 additions & 0 deletions Hello.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    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();
    }
    }