数据库连接问题,哪位大哥给小弟看看.
package pakejiaoyi;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.*;
public class Servlet2 extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=GBK ";
//Initialize global variables
public void init() throws
ServletException {
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException,
IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
String name=request.getParameter( "name ");//获取用户名
String num=request.getParameter( "text1 ");//获取购买书籍的数量
try {
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
} catch (
ClassNotFoundException ex) {
out.println( "加载错误 ");
}
String url= "jdbc:odbc:text ";
String ursename= "sa ";
String paw= " ";
Connection con=null;
Statement s=null;
PreparedStatement st=null;
ResultSet rs=null;
try {
con = DriverManager.getConnection(url, &n