// Connecting to a MySQL database via JDBC through Caucho-Resin

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

private Connection conn;

public void init()
   {
   // instantiate the MySQL JDBC driver. Using ClassForName/newInstance
   // rather than new means the driver need not be present at compile time.
   // Oddly, we need not retain a reference to the Driver object,
   // or even do a newInstance().

   try
      {
      Class.forName( "com.caucho.jdbc.mysql.Driver" )
      }
   catch ( Exception e )
      {
      System.out.println( "can't load caucho MySQL driver: " + e.getMessage() );
      }
   try
      {
      // log on to the allaboutsquirrels database
      conn = DriverManager.getConnection( "jdbc:mysql-caucho://localhost:3306/allaboutsquirrels", "myuserid", "sesame");
      }
   catch ( SQLException e )
      {
      System.out.println( "can't connect to MySQL: " + e.getMessage() );
      }
   }
...

// create the shell into which you can pour an SQL command.
Statement stmt = conn.createStatement();