How does one connect with the JDBC Thin Driver?

The JDBC thin driver provides the only way to access Oracle from the Web (using applets). It is smaller and faster than the OCI drivers, and doesn't require a pre-installed version of the Oracle Client software (w/ JDBC drivers). However, it doesn't support all the advanced features supported by the OCI driver.

Here is an example connect class:

import 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:1521: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();
  }
}