FileDocCategorySizeDatePackage
DataSourceConnectionLogging.javaAPI DocExample867Sat Aug 04 15:33:42 BST 2001None

DataSourceConnectionLogging

public class DataSourceConnectionLogging extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)


  OracleDataSource ds = new OracleDataSource();
  ds.setDriverType("thin");
  ds.setServerName("dssw2k01");
  ds.setPortNumber(1521);
  ds.setDatabaseName("orcl"); // sid
  ds.setUser("scott");
  ds.setPassword("tiger");
  ds.setLogWriter(
   new PrintWriter(
    new FileOutputStream("DataSourceConnectionLogging.log")));
  Connection conn = ds.getConnection();
  Statement stmt = conn.createStatement();
  ResultSet rset = stmt.executeQuery(
   "select 'Hello Thin driver tester '||USER||'!' result from dual");
  while(rset.next()) 
   System.out.println(rset.getString(1));
  rset.close();
  stmt.close();
  conn.close();