Topic: JDBC 连接错在哪里???

  Print this page

1.JDBC 连接错在哪里??? Copy to clipboard
Posted by: ytt613
Posted on: 2005-04-25 16:51

报错:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]
源程序为:
<%
String customerID=request.getParameter("CustomerID").trim();
String customerName=request.getParameter("CustomerName").trim();
String pwd=request.getParameter("password");
String repwd=request.getParameter("repassword");
String idCard=request.getParameter("IDCard");
String address=request.getParameter("address").trim();
String province=request.getParameter("Province");
String zipCode=request.getParameter("zipcode");
String phone=request.getParameter("phone");

strSql = "{call dbo.sp_insertcustomer(?,?,?,?,?,?,?,?,?)}";
cstmt = conn.prepareCall(strSql);
// Register the Output Parameter
cstmt.registerOutParameter(9, java.sql.Types.INTEGER);
//Set Input Parameters
cstmt.setString(1,customerID);
cstmt.setString(2,customerName);
cstmt.setString(3,pwd);
cstmt.setString(4,idCard);
cstmt.setString(5,address);
cstmt.setString(6,province);
cstmt.setString(7,zipCode);
cstmt.setString(8,phone);  

cstmt.executeUpdate();
  
int iR=cstmt.getInt(9);  
if(iR==0)
{
  session.putValue("user",customerID);
  %>
  <jsp:forward page="CustomerInfo.jsp?action=view"/>
  <%
}
else if(iR==1)
{
  %>
  <jsp:forward page="regist.htm"/>
  <%
}  

rs.close();
cstmt.close();
conn.close();

%>

JDBC连接测试过是好的,数据库相应的表和存储过程都正确地设置好了,实在不懂哪里出了错?

请大家帮忙!感激万分!

2.Re:JDBC 连接错在哪里??? [Re: ytt613] Copy to clipboard
Posted by: why
Posted on: 2005-04-25 18:00

What's the full error message?

3.Re:JDBC 连接错在哪里??? [Re: ytt613] Copy to clipboard
Posted by: ytt613
Posted on: 2005-04-25 18:09

我用的是BLazix

A java exception has occurred during the processing of this request.
Error occurred in JSP element starting at line number 8

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]

只有这些错误信息。

4.Re:JDBC 连接错在哪里??? [Re: ytt613] Copy to clipboard
Posted by: yhjvcnet
Posted on: 2005-06-02 14:32

把sql server的jdbc包放在web-inf/lib下。


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923