This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JDBC and the fly likes problem to Access database using JNDI name with Postgres Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "problem to Access database using JNDI name with Postgres " Watch "problem to Access database using JNDI name with Postgres " New topic
Author

problem to Access database using JNDI name with Postgres

Kaleeswaran Karuppasamy
Ranch Hand

Joined: Jul 19, 2007
Posts: 151
i use JNDI name for getting Datasource using java:comp/jdbc/env/(jndiname)
however i connat get connectin object error is no connection

i use below coding in tomcat /conf/server.xml

<Context path="/JEE" docBase="JEE"
debug="5" reloadable="true" crossContext="true">
<Resource name="jdbc/LyricNote" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="postgres" password="" driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost/struts"/>


</Context>

</Host>

i trying to get datasource my program


DataSource ds = (DataSource) ctx.lookup(java:comp/env/jdbc/LyricNote);
Connection con = ds.getConnection();

please help me!!


Judge a man by his questions rather than his answers --Voltaire
SCJP 1.5 97%
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2350

however i connat get connectin object error is no connection
Can you share the real, complete error message?

One of these two has to be wrong:
In the top of your post you say: jdbc/env/(jndiname)
Further on you say: env/jdbc/LyricNote

Regards, Jan
[ September 08, 2007: Message edited by: Jan Cumps ]

OCUP UML fundamental
ITIL foundation
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: problem to Access database using JNDI name with Postgres
 
Similar Threads
JMS and Websphere 6
Getting JNDI to work on Resin 2.1.14
Finding resources
IBatis JNDI Issue
postgres pool with Tomcat 4.1