[ JSP/JAVA ] MySQL connection fails
Hi all,
I've got this problem with JSP and MySQL: when I try to load my jsp page which should connect to the database, I get this error Code:
java.sql.SQLException: I have no firewalls blocking connections and I cannot understand why it does work with Java but not with JSP. I'm using Tomcat as webserver and all the jsp pages that don't use a database run correctly. Any ideas? Thank you very much :study: |
Maybe you can show us your code in charge of creating the connection? Are you using the correct username / password combination? Are you sure you have correctly set up the access rights in your database, considering your location?
|
Okay I attach both the Java and the JSP code; I'm not sure I've configured everything correctly, but I have a user "root" with no password and with the Java code it all works perfectly. Are there some other aspects of mysql configuration that I should have checked in order to make it work with tomcat/jsp?
Thank you. Java code (working): Code:
import java.awt.*; Code:
<%@ page import="java.sql.*" %> |
Okay, I fixed it out!
It was a tomcat policy problem. I had to add these lines to /etc/tomcat4/policy.d/04webapps.policy Code:
permission java.net.SocketPermission "127.0.0.1:3306", "connect,resolve"; |
Thanks
Hi,
I had the same problem when I updated my version of Tomcat 4 in Debian. As the above quote mentioned I added the following lines to my /etc/tomcat4/policy.d/04webapps.policy file Code:
permission java.net.SocketPermission "127.0.0.1:3306", "connect,resolve"; Code:
#bind-address = 127.0.0.1 Thanks. |
All times are GMT -5. The time now is 07:48 PM. |