Wednesday, June 4, 2008

Chuck Norris Facts

A lot of people with time on their hands have been adding "Chuck Norris facts" to this ongoing list, which contains several things Chuck Norris can do that you can't.

This is some serious hilarity:

'Chuck Norris’ hand is the only hand that can beat a Royal Flush.'

See the rest at http://chucknorrisfacts.com/

Tuesday, June 3, 2008

Connecting to an Oracle database using JDBC

Oracle has a proprietary JDBC driver that allows for native Java connections to an Oracle Database. First, you must download Oracle's JDBC Driver here and then include the jar archive into your project.

The code to connect to the database would be as follows:

public void createDBConn() {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@//server.local:1521/prod";
Connection conn = DriverManager.getConnection(url,"scott", "tiger");
conn.setAutoCommit(false);
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");

while (rset.next()) {
System.out.println (rset.getString(1));
}
stmt.close();
System.out.println ("Ok.");
}