Greetings,

Eric, I'm getting a "javax.naming.NameNotFoundException: Name jdbc is
not bound in this Context" exception!

I have a resource link inside my context (no resource here or
resource-ref in web.xml):

<resourceLink name="jdbc/ngincaredb"
        global="jdbc/ngincaredb_global"
        type="javax.sql.DataSource" />

and I'm doing a lookup in my code for "jdbc/ngincaredb":

Context initCtx = new InitialContext();
Context envCtx = (Context)initCtx.lookup("java:comp/env");
this.ds = (DataSource)envCtx.lookup("/jdbc/ngincaredb");

So, what's wrong here?

thanks,
Pedro Salazar.

On Mon, 2002-12-09 at 13:06, Roberts, Eric wrote:
> Pedro,
> 
> You need javax.sql - that is the package containing DataSource.
> Your Resource type should be: type="javax.sql.DataSource"
> You need these parameters in addition to url, username and password:
>       <parameter>
>         <name>driverClassName</name>
>         <value>oracle.jdbc.driver.OracleDriver</value>
>       </parameter>
>       <parameter>
>         <name>factory</name>
>         <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>       </parameter>
> 
> In the Context the ResourceLink type should be: type="javax.sql.DataSource"
> 
> You do not need any resource-ref in your web.xml - just use your ResourceLink name 
>as follows:
>       Context ctx = new InitialContext();
>       Context envCtx = (Context) ctx.lookup("java:/comp/env/");
>       DataSource ds = (DataSource) envCtx.lookup("/{name_of_resource_link}");
> 
>       if (ds != null) {
>               DbCon = ds.getConnection();
>       }
> 
> Hope this helps.

-- 
pedro salazar (pt-inovacao) <[EMAIL PROTECTED]>
key id: D803BC61


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to