• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem to Access database using JNDI name with Postgres

 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic