0
<%@page import="java.sql.*"%>
<form name="form" method="post" >
<b>Select a country:</b> </td>
<select name="sel"><option value=""><---Select---></option>
<%
Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
Connection con=DriverManager.getConnection("jdbc:jtds:sqlserver://subversion/sql2k8:1433/career","sa","Cloud#123");
PreparedStatement psmnt = con.prepareStatement("select * from country ");
ResultSet results = psmnt.executeQuery();
while(results.next()){
String name = results.getString(2);
String id = results.getString(1);
%><option value="<%= name %>"><%=name%></option>
<%} results.close(); psmnt.close(); %>
</select><br>
和自帶的錯誤: -碧玉例外occure到SQLServer的2008 R2
org.apache.jasper.JasperException: An exception occurred processing JSP page /1.dropdown_insert.jsp at line 13
10:
11:
12:
13: Connection con=DriverManager.getConnection("jdbc:jtds:sqlserver://subversion/sql2k8:1433/career","sa","Cloud#123");
14:
15: PreparedStatement psmnt = con.prepareStatement("select * from country ");
16: ResultSet results = psmnt.executeQuery();
堆棧跟蹤:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:519)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:410)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
請張貼滿堆棧跟蹤 – 2011-05-23 10:14:24