在这里,我试图通过JDBC
.
这是我的代码,最终出现以下异常。
<%@ page import ="java.sql.*" %>
<%@ page import ="javax.sql.*" %>
<%
Connection con = null;
String url = "jdbc:jtds:sqlserver://192.168.0.123:4070/";
String db = "RUTHER_FORD";
String driver = "net.sourceforge.jtds.jdbc.Driver";
String userName ="RUTHER";
String password="SORRY_CONFIDENTIAL";
int sumcount=0;
Statement st;
try{
Class.forName(driver).newInstance();
con = DriverManager.getConnection(url+db,userName,password);
String query = "select * from user_master";
st = con.createStatement();
ResultSet rs = st.executeQuery(query);
%>
<%
while(rs.next()){
%>
<%System.out.println(rs.getString(1));%>
<%System.out.println(rs.getString(2));%>
<%
}
%>
<%
}
catch(Exception e){
e.printStackTrace();
}
%>
<html>
.
.
.
.
//下面是我在调度页面时面临的异常
java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:166)
at java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1512)
下面我又看到了一个例外
java.security.AccessControlException: access denied (java.io.FilePermission C:\Windows\TEMP read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:166)
at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
at java.io.File.isDirectory(File.java:752)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.unpackProperties(ConnectionJDBC2.java:1253)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:280)
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at org.apache.jsp.mmrda_005fsupplierportal.index_002dleft_002dcontainer_jsp._jspService(index_002dleft_002dcontainer_jsp.java:71)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
P.S I added jtdc.1.2.5 jar to my `class path`.
我缺少什么?对此有任何建议吗?
谢谢你的时间。