jsp-java.security.AccessControlException中的jdbc连接:拒绝访问(“java.lang.RuntimePermission”accessClassInPackage.sun.jdbc.odbc)
我正试图通过JDBC连接到一个localmysql数据库,但访问被拒绝(我正在为云sql做gap,并试图在本地进行测试) 我尝试编辑java主页并授予所有权限,还尝试(单独)在eclipse的vm变量中添加策略文件并添加对它的引用,但没有任何效果。 我为这件事发疯了,不知道我做错了什么。谢谢 我的代码jsp-java.security.AccessControlException中的jdbc连接:拒绝访问(“java.lang.RuntimePermission”accessClassInPackage.sun.jdbc.odbc),java,database,google-app-engine,jdbc,Java,Database,Google App Engine,Jdbc,我正试图通过JDBC连接到一个localmysql数据库,但访问被拒绝(我正在为云sql做gap,并试图在本地进行测试) 我尝试编辑java主页并授予所有权限,还尝试(单独)在eclipse的vm变量中添加策略文件并添加对它的引用,但没有任何效果。 我为这件事发疯了,不知道我做错了什么。谢谢 我的代码 String url = null; if (SystemProperty.environment.value() == SystemProperty.Environment.Value.
String url = null;
if (SystemProperty.environment.value() ==
SystemProperty.Environment.Value.Production) {
// Load the class that provides the new "jdbc:google:mysql://" prefix.
Class.forName("com.mysql.jdbc.GoogleDriver");
url = "jdbc:google:mysql://trivia818id:geninstance/guestbook?user=root&password=freedom818";
} else {
// Local MySQL instance to use during development.
Class.forName("com.mysql.jdbc.Driver");
url = "jdbc:mysql://127.0.0.1:3306/guestbook?user=root&password=freedom818";
}
Connection conn = DriverManager.getConnection(url);
我在eclipse中遇到的错误
String url = null;
if (SystemProperty.environment.value() ==
SystemProperty.Environment.Value.Production) {
// Load the class that provides the new "jdbc:google:mysql://" prefix.
Class.forName("com.mysql.jdbc.GoogleDriver");
url = "jdbc:google:mysql://trivia818id:geninstance/guestbook?user=root&password=freedom818";
} else {
// Local MySQL instance to use during development.
Class.forName("com.mysql.jdbc.Driver");
url = "jdbc:mysql://127.0.0.1:3306/guestbook?user=root&password=freedom818";
}
Connection conn = DriverManager.getConnection(url);