Title:
Harley,
 
I am new to all this, but I am curious why you are trying to bind your datasource programmatically.  Here's what I have in my $ORION_HOME/config/data-sources.xml:
 
<data-source
    class="oracle.jdbc.pool.OracleConnectionPoolDataSource"
    connection-driver="oracle.jdbc.driver.OracleDriver"
    connection-retry-interval="1"
    inactivity-timeout="30"
    location="jdbc/MyDataSource"
    max-connections="10"
    min-connections="0"
    name="MyDataSource"
    password="tiger"
    url="jdbc:oracle:thin:@myserver:1521:MYSID"
    username="scott"
    wait-timeout="10"
/>
 
Then, from within my Java code, I have:
 
    ...
    InitialContext ctx = new InitialContext(System.getProperties());
    PooledConnection pc = (PooledConnection)pc.lookup("jdbc/MyDataSource")
    Connection conn = pc.getConnection();
    ...
 
Am I missing something?  Wouldn't this work?  (Essentially, Orion does the JNDI binding for you.)
 
    Attila
 
   

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Harley Rana
Sent: Monday, May 07, 2001 11:43 AM
To: Orion-Interest
Subject: Binding OracleConectionPoolDataSource to JNDI name?

I have used the OracleConnectionPoolDataSource form a normal class, with out binding it to JNDI and it works fine.  When i try and bind it i get an exception that saying :
Error binding to server: java.io.NotSerializableException: oracle.jdbc.driver.OracleDriver
Anyone got this working?
this is the code in the constructor of a normal class. im using Oracle8i 1.1.7

Thanks alot for any help you can give!

Harley Rana.

        try{
            System.setProperty("java.naming.factory.initial","com.evermind.server.ApplicationClientInitialContextFactory");
            System.setProperty("java.naming.provider.url", "ormi://localhost/Togotech");
            System.setProperty("java.naming.security.principal","admin");
            System.setProperty("java.naming.security.credentials","rana21b");
           
            InitialContext jndiContext = new InitialContext();
            OracleConnectionPoolDataSourcepool = new oracle.jdbc.pool.OracleConnectionPoolDataSource();
            pool.setURL("jdbc:oracle:thin:@localhost:1521:net");
            pool.setUser("scott");
            pool.setPassword("tiger");
            pool.setDataSourceName("Togotech_Data");
            System.out.println("Binding to JNDI...");
            jndiContext.rebind("OracleDatasource",pool);
        }catch(SQLException s){
            System.out.println("SQL exception - "+s);
        }
        catch(NamingException n){
            System.out.println("Naming exception - "+n);
        }

Reply via email to