Ben Keeping

Greenhorn
+ Follow
since Jan 19, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ben Keeping

Other Ben :
I have to disagree there - the OP said they were trying to connect to mysql from within the tomcat container. IMO, this kind of JDBC connectivity is common, and so probably used from many webapps (in theory), and so the easiest way to achive that is to dump the driver jar into common/lib - this makes it accessible to the container, any 3rd party pool that is running inside that container, and webapps. Its very rare that you have multiple driver versions, so common/lib is the best place - just put it in, and forget about it. Even better would be to place it in JAVA_HOME/jre/lib/ext, but I didn't want to confuse the issue !
Can you ping the host you are trying to connect to ?
Can you ping any other machines ?
Is the network card functioning correctly ?
Are your iptables or firewall blocking your connection ?
I expect your ClassNotFoundException is thrown because you have not added the mysql JDBC driver to TOMCAT_HOME/common/lib .
Download it from here : http://www.mysql.com/products/connector/j/
This is a crosspost with the servlet forum.
19 years ago
JSP
Your question is "how to upload file into a database" - so you use the FileInputStream to read the file ! Try out the API docs ...

Also, please do not crosspost threads (Servlet forum and JSP forum).
19 years ago
I take it you mean as a binary BLOB field in the db ?
19 years ago
I really think if you are updating using a large SQL statement, you should use a stored procedure if possible - more efficient and safer ...
Perhaps you should consider synchronizing your db-interaction methods ? This would guard against any deadlocks db side ...
SOAP generally only supports primitive data types, string and base65 encoded binary data. I'm not sure SOAP is the best thing for transmitting custom data types (ie classes), because while you could serialize a class into a byte[] and then encode that as base64, and send that, how would a non-Java client understand the data ? I think for transmitting custom classes, you are much better off with using RMI, which will handle the serialization of a class for you ...
19 years ago
You need to add the MySQL JDBC driver to your CLASSPATH.
The driver is usually named something like : mysql-connector-java-3.0.9-stable-bin.jar
Either add it explicitly to your CLASSPATH or add it into JAVA_HOME/jre/lib/ext directory.
and can be downloaded if you have not already got it from http://www.mysql.com/products/connector/j/