当前位置: 代码迷 >> J2EE >> com.microsoft.sqlserver.jdbc.SQLServerException: 没有为参数号 2 设置值。
  详细解决方案

com.microsoft.sqlserver.jdbc.SQLServerException: 没有为参数号 2 设置值。

热度:456   发布时间:2016-04-22 03:35:46.0
hibernate3.1调用存储过程有问题。急...急...
color=#FF0000]这个问题已经困扰我很久了,这是我前段时间发的贴,到现在还没有的到好的解决方案,麻烦大家帮我解决下。谢谢,[/color]
前贴: http://topic.csdn.net/u/20080219/09/392dc641-12c4-4426-ba89-841bcc09e05f.html?seed=2134387670

经过这几天我在网络上找的解决方案,目前是报这样的错误。错误信息如下:
HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: could not execute query
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

org.hibernate.exception.GenericJDBCException: could not execute query
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82)
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.loader.Loader.doList(Loader.java:1596)
org.hibernate.loader.Loader.list(Loader.java:1577)
org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:112)
org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1414)
org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:153)
com.ssh.hbm.UserInfoDAO.select_User(UserInfoDAO.java:43)
com.ssh.struts.action.UserInfoAction.execute(UserInfoAction.java:42)
org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

com.microsoft.sqlserver.jdbc.SQLServerException: 没有为参数号 2 设置值。
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.buildParamTypeDefinitions(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.buildPreparedStrings(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doPrepExec(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(Unknown Source)
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:168)
org.hibernate.dialect.SybaseDialect.getResultSet(SybaseDialect.java:142)
org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:127)
org.hibernate.loader.Loader.getResultSet(Loader.java:1269)
org.hibernate.loader.Loader.doQuery(Loader.java:391)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
org.hibernate.loader.Loader.doList(Loader.java:1593)
  相关解决方案