I am trying to get a jsp page to run a SQL query on it. When I run the page it comes up with an error saying No Suitable Driver Found.
I am using a conext.xml and a web.xml file to define a Datasource. It works on my other computer which is running windows. But this page is on an ubuntu server. I put the mysql-connector-java-5.1.7-bin.jar in the /usr/share/tomcat6/lib folder. I also put it in the WEB-INF/lib directory. I wrote a java application that uses the same connection string and it works just fine. It errors on this line
andrew bliss wrote: I put the mysql-connector-java-5.1.7-bin.jar in the /usr/share/tomcat6/lib folder.
put it under tomcat6/common/ lib folder
andrew bliss
Greenhorn
Joined: Dec 09, 2008
Posts: 12
posted
0
I have tried that. First there is no common folder so I created one, put it in there and it still came up with the same error.
I have been looking around to see if how it checks the class path, I haven't found anything on that yet. Is there some way to set the classpath?
Thanks for the reply.
Ok so I made a new page that doesn't use the context file for the database source.
It said to turn TOMCAT_SECURITY to no. I did that and my new page works now. But my old one that uses the context.xml doesn't.
Is this the best thing to do? I didn't have to do this on my windows machine.
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
0
seetharaman venkatasamy wrote:
andrew bliss wrote: I put the mysql-connector-java-5.1.7-bin.jar in the /usr/share/tomcat6/lib folder.
put it under tomcat6/common/ lib folder
That path only applies to Tomcat versions before 6.x only (thus, 5.5 and older).
Tomcat6/lib is the right path to place JAR's which are to be covered by the appserver's classpath.
Back to the actual problem: this is certainly not a classpath issue, you would get a ClassNotFoundException otherwise, not a SQLException with the message "No suitable driver". You will get this exception when the driver isn't loaded at all, or the JDBC URL is wrong.
So my one page is working without the context file. I had to turn off the TOMCAT_SECURITY.
Then my other page that uses the context file still says No Suitable Driver found, it has the exact URL.
Could it be that it isn't locating the context file? I put it in the META-INF dir under the DBtest dir where all the files are.