我用sqlserver的连接方式连接2008的库!驱动和连接字符串都是用2000的方式。但是在执行存储过程中出现了错
误,java.sql.SQLException:[Microsoft][SQLServerJDBCDriver][SQLServer]传入的表格格式数据流(TDS)远程过...
误,java.sql.SQLException: [Microsoft][SQLServer JDBC Driver][SQLServer]传入的表格格式数据流(TDS)远程过程调用(RPC)协议流不正确。参数 4 (""): 数据类型 0x38 未知。
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.execute(Unknown Source)
代码是这样子的!
sqlStr = "{?=call Z_CreateDly(?,?,?,?,?,?,?,?)}";
System.out.println(sqlStr);
cstm = databaseConnect.prepareCall(sqlStr);
cstm.setInt(2, bakdly_vchcode);
cstm.setString(3, "");
cstm.setString(4, "");
cstm.setString(5, "");
// cstm.setString(6, ktypeid2);
cstm.setString(6, vchCode + "");
cstm.setInt(7, 0);
cstm.setInt(8, 0);
cstm.setInt(9, 0);
cstm.registerOutParameter(1, Types.INTEGER);
cstm.registerOutParameter(3, Types.VARCHAR);
cstm.registerOutParameter(4, Types.VARCHAR);
cstm.registerOutParameter(5, Types.VARCHAR);
cstm.registerOutParameter(6, Types.VARCHAR);
cstm.execute(); 展开
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.execute(Unknown Source)
代码是这样子的!
sqlStr = "{?=call Z_CreateDly(?,?,?,?,?,?,?,?)}";
System.out.println(sqlStr);
cstm = databaseConnect.prepareCall(sqlStr);
cstm.setInt(2, bakdly_vchcode);
cstm.setString(3, "");
cstm.setString(4, "");
cstm.setString(5, "");
// cstm.setString(6, ktypeid2);
cstm.setString(6, vchCode + "");
cstm.setInt(7, 0);
cstm.setInt(8, 0);
cstm.setInt(9, 0);
cstm.registerOutParameter(1, Types.INTEGER);
cstm.registerOutParameter(3, Types.VARCHAR);
cstm.registerOutParameter(4, Types.VARCHAR);
cstm.registerOutParameter(5, Types.VARCHAR);
cstm.registerOutParameter(6, Types.VARCHAR);
cstm.execute(); 展开
1个回答
展开全部
2008和2000不是一样的 就架包都不是一样的
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value>
</property>
<property name="url">
<value>jdbc:sqlserver://X0YRQXHHUE52PXC:1433;databaseName=db</value>
</property>
<property name="username">
<value>sa</value>
</property>
<property name="password">
<value>1</value>
</property>
</bean>
这个是我SSH搭建连接2008的代码 连接字符串和驱动和2000的不一样的 架包也不一样
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value>
</property>
<property name="url">
<value>jdbc:sqlserver://X0YRQXHHUE52PXC:1433;databaseName=db</value>
</property>
<property name="username">
<value>sa</value>
</property>
<property name="password">
<value>1</value>
</property>
</bean>
这个是我SSH搭建连接2008的代码 连接字符串和驱动和2000的不一样的 架包也不一样
追问
你可以用sql2000的驱动,2000的字符串连接一下sqlserver2008,这个是没有问题的!因为我这么连接是成功的!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询