wood burning stoves 2.0*
The moose likes Spring and the fly likes Cannot get Spring database connection work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Cannot get Spring database connection work" Watch "Cannot get Spring database connection work" New topic
Author

Cannot get Spring database connection work

Yan Zhou
Ranch Hand

Joined: Sep 02, 2003
Posts: 137
I am configuring my Spring app to use Tomcat (Spring tc server), I am getting this error when tc Server 6.0.20 starts up with my app. deployed.

Caused by: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

I have used the following server.xml with datasource configured.

<GlobalNamingResources>
<Resource auth="Container" driverClassName="oracle.jdbc.OracleDriver" maxActive="10" name="jdbc/MyDataSource" password="password" type="javax.sql.DataSource" url="....." username="yan"/>
</GlobalNamingResources>

This is my Spring config XML

<jee:jndi-lookup id="datasource" jndi-name="jdbc/MyDataSource" resource-ref="true"/>

I do not think I missed anything, but cannot seem to get database connection to work.

Thanks,
Yan
selva raja
Ranch Hand

Joined: Nov 24, 2009
Posts: 69
Please refer the spring 2.0 pdf. you get it more information about JNDI.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot get Spring database connection work
 
Similar Threads
Connection Pooling Managment
No suitable driver error when configuring JDBC datasource for Tomcat and Struts
Name jdbc is not bound in this Context :Error TomCat 6
Can't create SQL Server 2000 Datasource on Tomcat 5.5.12
No suitable driver error when configuring JDBC datasource for Tomcat and Struts