FileDocCategorySizeDatePackage
TestThinDSApp.javaAPI DocExample849Thu Nov 16 20:11:32 GMT 2000None

TestThinDSApp

public class TestThinDSApp extends Object

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


  // These settings are typically configured in JNDI
  // so they a implementation specific
  OracleDataSource ds = new OracleDataSource();
  ds.setDriverType("thin");
  ds.setServerName("dssw2k01");
  ds.setPortNumber(1521);
  ds.setDatabaseName("orcl"); // sid
  ds.setUser("scott");
  ds.setPassword("tiger");

  Connection conn = ds.getConnection();

  Statement stmt = conn.createStatement();
  ResultSet rset = stmt.executeQuery(
   "select 'Hello Thin driver data source tester '||" + 
    "initcap(USER)||'!' result from dual");
  if (rset.next()) 
   System.out.println(rset.getString(1));
  rset.close();
  stmt.close();
  conn.close();