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.
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
Arduino in Action
this week in the
General Computing
forum!
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
JavaRanch
»
Java Forums
»
Databases
»
JDBC
Author
problem to Access database using JNDI name with Postgres
Kaleeswaran Karuppasamy
Ranch Hand
Joined: Jul 19, 2007
Posts: 151
posted
Sep 08, 2007 00:26:00
0
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
I like...
posted
Sep 08, 2007 03:46:00
0
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
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter