Java 连接到Google应用程序引擎SQL实例错误
我正在尝试从eclipse连接到Google SQL实例。我在我的web inf lib文件夹中添加了SQL驱动程序jar:mysql-connector-java-5.0.8-bin.jarJava 连接到Google应用程序引擎SQL实例错误,java,mysql,eclipse,google-app-engine,Java,Mysql,Eclipse,Google App Engine,我正在尝试从eclipse连接到Google SQL实例。我在我的web inf lib文件夹中添加了SQL驱动程序jar:mysql-connector-java-5.0.8-bin.jar // Connecting from App Engine. if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Production) { // Load the class that p
// Connecting from App Engine.
if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Production) {
// Load the class that provides the "jdbc:google:mysql://" prefix.
Class.forName("com.mysql.jdbc.GoogleDriver");
url ="jdbc:google:mysql://appid:instance/dbname";
} else {
// Connecting from an external network.
Class.forName("com.mysql.jdbc.Driver");
url = "jdbc:mysql://173.*.*.*:3306?user=root";
}
Connection conn = DriverManager.getConnection(url,"***","***");
Log.info(url);
ResultSet rs = conn.createStatement().executeQuery(
"SELECT * from icidev.users");
log.info(rs.toString())
以下是输出:
Oct 15, 2015 4:13:25 PM **com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
SEVERE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
java.lang.ExceptionInInitializerError**
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.intellioption.callinfo.MyService.connectDB(MyService.java:61)
at com.intellioption.callinfo.MyService.getEmployee(MyService.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:130)
**Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup")**
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:429)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkAccess(DevAppServerFactory.java:454)
at java.lang.ThreadGroup.checkAccess(Unknown Source)
我可以使用我的本地MySQL连接,只需验证我的凭据。您真的不应该在日常使用中使用MySQL root用户,尤其是当您将db服务器暴露于普通网络时。这是一个巨大的安全漏洞。你能说得更具体一点吗?我是应用程序引擎的新手,我不明白你在@MarcB发布了什么