Re: Connecting to MySQL on GoDaddy.com

"Don Smith" <[email protected]> Fri, 18 May 2007 10:30:37 -0400
Newsgroups gmane.comp.db.mysql.java
Message-ID <[email protected]>
The stack trace looks more like network connectivity problems than MySQL access issues, but I've often run into MySQL permission problems that cause strange stack traces.  The issue is usually granting permission for the user to the database, from a specific host. The specific host part is usually the problem. I use these commands to create users in MySQL for JDBC access:

GRANT ALL PRIVILEGES ON *.* TO <username>@localhost IDENTIFIED BY 'password'  (if the app server and the MySQL server run on the same machine)
GRANT ALL PRIVILEGES ON *.* TO <username>@hostname IDENTIFIED BY 'password'   (the hostname here is the host of the app server where the servlet is running)
 
For the network connectivity possibility:  check your JDBC url. You may need to use the IP address for the host name, if the DNS is not resolving it correctly. If there is a DNS problem, you may need to add a grant using the IP address of the app server host, similar to second grant above, but substitute the IP address for the hostname.

Hope this helps,
Don


>>> "Flint Gatrell" <[email protected]> 5/17/2007 5:16 PM >>>
Hello,

I have a Linux hosting account with Java enabled, and I am trying to make a
connection to my MySQL database from one of my servlets.  I have been
successful in connecting to MySQL from this servlet on my local machine, but
I have been unable to figure it out in my "live" environment.

The error I receive is included below.

Has anyone else solved a similar problem before with their own servlets? Or
has anyone got any ideas of where I can look for someone that has?
GoDaddy's tech support seems unwilling to assist.

I can post code snippets upon request.

Thanks,
Flint

Exception report:

com.mysql.jdbc.CommunicationsException: Communications link failure due to
underlying exception: ** BEGIN NESTED EXCEPTION **
java.security.AccessControlException MESSAGE: access denied
(java.net.SocketPermission mysql p41mysql3.secureserver.net resolve)
STACKTRACE: java.security.AccessControlException: access denied
(java.net.SocketPermission mysql p41mysql3.secureserver.net resolve) at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
at java.security.AccessController.checkPermission(AccessController.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) at
java.lang.SecurityManager.checkConnect(SecurityManager.java:1031) at
java.net.InetAddress.getAllByName0(InetAddress.java:1117) at
java.net.InetAddress.getAllByName0(InetAddress.java:1098) at
java.net.InetAddress.getAllByName(InetAddress.java:1061) at
com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:137)
at com.mysql.jdbc.MysqlIO.(MysqlIO.java:276) at
com.mysql.jdbc.Connection.createNewIO(Connection.java:2666) at
com.mysql.jdbc.Connection.(Connection.java:1531) at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(DriverManager.java:525) at
java.sql.DriverManager.getConnection(DriverManager.java:193) at
myservlets.dbUtilities.connect(dbUtilities.java:46) at
myservlets.MySQLAccess.processRequest(MySQLAccess.java:49) at
myservlets.MySQLAccess.doPost(MySQLAccess.java:95) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:419)
at
org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at
sun.reflect.GeneratedMethodAccessor136.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585) at
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239) at
java.security.AccessController.doPrivileged(Native Method) at
javax.security.auth.Subject.doAsPrivileged(Subject.java:517) at
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266) at
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at
org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
at
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:140)
at java.security.AccessController.doPrivileged(Native Method) at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:136)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at
org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:417)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300) at
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374) at
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743) at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866) at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:595) ** END NESTED EXCEPTION ** Last
packet sent to the server was 1 ms ago.
SQL State: 08S01
SQL ErrorCode: 0


-- 
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java 
To unsubscribe:    http://lists.mysql.com/[email protected] 


-- 
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe:    http://lists.mysql.com/[email protected]