FileDocCategorySizeDatePackage
TestExternalConnection.javaAPI DocExample720Mon May 21 19:11:36 BST 2001None

TestExternalConnection

public class TestExternalConnection extends Object

Fields Summary
Constructors Summary
Methods Summary
public static java.lang.StringgetGreeting()

  Class.forName("oracle.jdbc.driver.OracleDriver");
// or you can use:
//  DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
  String greeting = null;
  Connection conn = 
   DriverManager.getConnection(
    "jdbc:oracle:thin:@dssnt01:1521:dssora01", "scott", "tiger");
  Statement  stmt = conn.createStatement();
  ResultSet  rset = stmt.executeQuery(
   "select 'Hello '||initcap(USER)||'!' result from dual");
  if (rset.next()) 
   greeting = rset.getString(1);
  rset.close();
  stmt.close();
  conn.close();
  return greeting;