You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Willian Mitsuda <wm...@yahoo.com.br> on 2002/10/01 05:59:44 UTC

Re: Datasource

Try this:

DataSource ds = (DataSource) ic.lookup("java:comp/env/myjndi");

but you should use this (note the "/jdbc" before "/myjndi"):

DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/myjndi");

and bind your datasource to the name "jdbc/myjndi".


All environment resources are bind to the root naming context
"java:comp/env".
The specs sugests to use the naming context "jdbc" for datasources.

----- Original Message -----
From: "Lindomar" <li...@bol.com.br>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Sunday, September 29, 2002 3:40 PM
Subject: Datasource


Hi everybody!
I'm using this code for connect my app in tomcat 4.1:
$$$$$$$$
...
Connection conn = null;
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource)ic.lookup("myjndi")
     conn = ds.getConnection();
...
$$$$$$$$$
I configurate my connection in Adminitration Tool of tomcat.
For JNDI Name i set to "myjndi"

Until here ok, but when i start my app, appears exception:
Name myjndi is not bound in this Context

Any idea for this problem?

Thanks in advanced.





_______________________________________________________________________
Yahoo! GeoCities
Tudo para criar o seu site: ferramentas fáceis de usar, espaço de sobra e acessórios.
http://br.geocities.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>