aspose file tools*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
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: 154
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: 2500
    
    8

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 and ITIL foundation
youtube channel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem to Access database using JNDI name with Postgres