aspose file tools*
The moose likes Tomcat and the fly likes How to connect mysql database with struts application through jndi Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How to connect mysql database with struts application through jndi" Watch "How to connect mysql database with struts application through jndi" New topic
Author

How to connect mysql database with struts application through jndi

Satchidananda Mohanty
Ranch Hand

Joined: Mar 12, 2008
Posts: 77

Hi,

Could you say me how to connect the mysql database from a struts application through jndi process.

I have used these steps..



in my action class i have used



after deploying this i got this error

javax.servlet.ServletException: javax.naming.NameNotFoundException: mydatabase not found

SO i have checked with driver file,context.xml file.
I saw this from http://wiki.metawerx.net/wiki/JNDIDBCPExampleForMySQL5.x

If you get a javax.naming.NameNotFoundException error, you have either not installed the context.xml file correctly, or have used a different name in the context.xml <Resource> element's "name" attribute to what you are using in your Context.lookup() call.

I think some more configuration is requird to use the context.xml file..

can anybody help me regarding this..


Thanks in advance..
zeet


Zeet

SCJP 6.0
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38793
    
  23
Posted in wrong forum. Moving thread.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Please refer to this Tomcat docs:
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
and edit the web.xml as given there.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Satchidananda Mohanty
Ranch Hand

Joined: Mar 12, 2008
Posts: 77

Thanks a lot Sagar,
I am going through that..
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It's certainly not a Struts question. Moving to Tomcat for now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to connect mysql database with struts application through jndi