Re: Error converting data type varchar to int



Show the JDBC code that includes the statement creation, and the
setting of inputs, and declaring of outputs...
Joe

Russ_from_Alabama wrote:

I should clarify that I ran the store procedure in SQL Query Analyzer and it works as design. Addtionally, the java code is straightforward, so I am left to believe the JDBC Driver has an issue.

Thanks for reading my post.

Russ

"Russ_from_Alabama" wrote:


I have a problem with getting the error code from the callable statement.

I declare position 14 in the callable statement as an INTEGER for the error code. The store procedure runs and comes back, but I receive this error when I try to access the data:


[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Error converting data type varchar to int.
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.base.BaseStatement.getNextResultType(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.base.BaseCallableStatement.getAndValidateOutParameter(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.base.BaseCallableStatement.getString(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbcx.base.BaseCallableStatementWrapper.getString(Unknown Source)

Here is the source code for setting up the CallableStatement. All the other parameters are Strings or floats.



call.registerOutParameter(14, java.sql.Types.INTEGER);

/*Executing SP*/
call.execute();



/*Check ErroCode*/
checkDBErrorCode(
fails here >>>>>>>>> call.getInt(14),
"<firstFail>"
+ call.getString(12)
+ "</firstFail> - "
+ call.getString(13),
CLASS_NAME,methodName);





The Store Procedure inputs looks like this:



CREATE PROCEDURE BatchQuickProcess
@p_taskids VARCHAR(600),
@p_qpstatus VARCHAR(1),
@p_qpreviewoper CHAR(8),
@p_actdesc CHAR(10),
@p_dptdesc CHAR(10),
@p_tskdesc CHAR(10),
@p_table VARCHAR(1), @p_defaultwd FLOAT,
@p_defaultwt FLOAT,
@p_wrkbskt VARCHAR(8),
@p_operid VARCHAR(8),
@p_curtskid VARCHAR(11) OUTPUT,
@p_reterror VARCHAR(255) OUTPUT,
@p_retcode INT OUTPUT,
@p_commit CHAR(1) = 'Y'



I am using SQL Server 2000 with JDBC Drivers Version 2.2.0040, Service Pack 3

Any help or insight would be greatly appreciated.

.


Loading