FileDocCategorySizeDatePackage
TestDSBind.javaAPI DocExample961Tue Nov 21 11:04:32 GMT 2000None

TestDSBind

public class TestDSBind extends Object

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

  
  // For this to work you will need to create the
  // directories /JNDI/JDBC on your file system first
  Context ctx = null;
  try {
   Properties prop = new Properties();
    prop.setProperty(
     Context.INITIAL_CONTEXT_FACTORY, 
     "com.sun.jndi.fscontext.RefFSContextFactory");
    prop.setProperty(
     Context.PROVIDER_URL, 
     "file:/JNDI/JDBC");
   ctx = new InitialContext(prop);
  } 
  catch (NamingException ne) {
   System.err.println(ne.getMessage());
  }

  OracleDataSource ds = new OracleDataSource();
  ds.setDriverType("thin");
  ds.setServerName("dssw2k01");
  ds.setPortNumber(1521);
  ds.setDatabaseName("orcl");
  ds.setUser("scott");
  ds.setPassword("tiger");

  ctx.bind("joe", ds);