jdbc CallableStatement Issue

Hello all so I have literly beat my head against a wall on this issue.

rundown: I am using a callablestatement to access a mssql db stored procedure through jdbc, (if you would like the driver info i can post l8tr). My code is simple but I keep getting the following error and I have tried everything and searched everywhere it seems to fix this so I behold myself to you the wiser.

MSSQL Stored Procedure:

CREATEPROCEDURE www_Check_Disp_Contrato_Tipo_Fechas@cont int,

@thab int,

@f_ent datetime,

@f_sal datetime,

@respetar_release bit,

@lDispbit output

AS

/* Procedimiento que chequea si hay disponibilidad contra cupos para todos los dias del periodo de fechas pasado como parametro de un

contrato para un tipo de habit dado y respetando el release del contrato, solo devuelve 1 si hay disponibilidad para todos los dias

*/

begin

declare @dia_inic datetime, @release int, @disp int,@cupos int,

@dia_sal datetime,@fecha_hotelera datetime,@ocup int,

@reserv int,@hab_salen int, @ncupos int, @roomint

Select @dia_sal = @f_sal

Select @dia_inic = @f_ent

Select @lDisp= 1

Select @fecha_hotelera = fecha_hotelera From Hotetabl

While DATEDIFF(day,@dia_inic,@dia_sal) >= 0 and @lDisp = 1

begin

Execute Calc_Hab_Sal_Dia_Cont_Tipo@cont, @thab, @dia_inic, @hab_salen output

Execute Calc_Cupos_Cont_Dia_Tipo@cont, @dia_inic, @thab, @cupos output

Execute Calc_Hab_Ocup_Cont_Dia_Tipo@cont, @dia_inic, @thab, @ocup output

Execute Calc_Hab_Res_Cont_Dia_Tipo@cont, @dia_inic, @thab, @reserv output

Execute Calc_Hab_Room_Cont_Dia_Tipo@cont, @dia_inic, @thab, @room output

Execute Calc_Release_Contrato@cont, @dia_inic, @release output

if @respetar_release = 1

if DATEDIFF(day,@fecha_hotelera,@dia_inic) < @release

Select @ncupos = 0

else

Select @ncupos = @cupos

else

Select @ncupos = @cupos

Select @disp = @ncupos - @ocup - @reserv - @room + @hab_salen

if @disp <= 0

Select @lDisp = 0

Select @dia_inic = DATEADD(day,1, @dia_inic)

end

end

***************************************

The Code I'm using:

CallableStatement cs = conn.prepareCall("{call www_Check_Disp_Contrato_Tipo_Fechas(?,?,?,?,?,?)}");

int cont = 632;

int thab = 112;

java.sql.Date entrada = new java.sql.Date(2006,01,15);

java.sql.Date salida = new java.sql.Date(2006,01,18);

cs.setInt(1, cont);

cs.setInt(2, thab);

cs.setDate(3, entrada);

cs.setDate(4, salida);

cs.setBoolean(5, true);

cs.registerOutParameter(6, Types.NUMERIC);

cs.execute();

int outParam2 = cs.getInt(6);

****************************************************

I receive the following error msg:

[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Formal parameter '@respetar_release' was defined as OUTPUT but the actual parameter not declared OUTPUT

****************************************************

To me it makes no sense becuase I am not defining the 5th input "respetar_release" as the OUTPUT?

Any suggestions or links will be greatly appreciated as I cannot sleep until this is resolved!! :(

Thanks in advance, peace to all of you!

[3613 byte] By [hbskunka] at [2007-10-2 9:19:24]
# 1
I appologize I believe this might be in the incorrect forum also. Sorry!
hbskunka at 2007-7-16 23:26:27 > top of Java-index,Java Essentials,Java Programming...
# 2

> I appologize I believe this might be in the incorrect

> forum also. Sorry!

Looks that way to me, at least a bit. I admit having no idea at all about callable statements, and I hate databases from the bottom of my heart. But I thought those thingies are a database-native thing, so you might be better of asking at a MySQL forum?

CeciNEstPasUnProgrammeura at 2007-7-16 23:26:27 > top of Java-index,Java Essentials,Java Programming...
# 3
> might be better of asking at a MSSQL forum?
CeciNEstPasUnProgrammeura at 2007-7-16 23:26:27 > top of Java-index,Java Essentials,Java Programming...
# 4

Boy... I gotta tell you I'm not seeing what the problem is. I do know that that driver is terrible so I wouldn't put it past it that it is complaining about the wrong bug or the driver is otherwise screwing it up.

To troubleshoot I suggest the following steps.

1) Try and remove as much of the stored proc as you can... because maybe the bug is in there. But I'm not seeing it...

2) Try another driver.

3) If both those don't help solve the issue then I am forced to conclude it is a bug in your code. Could you get rid of the @respetar_release column and see if it is some type conversion issue.

CeciNEstPasUnProgrammeura at 2007-7-16 23:26:27 > top of Java-index,Java Essentials,Java Programming...
# 5

> > I appologize I believe this might be in the

> incorrect

> > forum also. Sorry!

>

> Looks that way to me, at least a bit. I admit having

> no idea at all about callable statements, and I hate

> databases from the bottom of my heart. But I thought

> those thingies are a database-native thing, so you

> might be better of asking at a MS-SQL forum?

Assuming the procedure compiles he is in the right place.

Wrong forum in the right place.

CeciNEstPasUnProgrammeura at 2007-7-16 23:26:27 > top of Java-index,Java Essentials,Java Programming...
# 6
> Assuming the procedure compiles he is in the right> place. Well, I'd guess it does then.> Wrong forum in the right place.I see. :) Go ahead.
CeciNEstPasUnProgrammeura at 2007-7-16 23:26:27 > top of Java-index,Java Essentials,Java Programming...
# 7
*sigh*
CeciNEstPasUnProgrammeura at 2007-7-16 23:26:27 > top of Java-index,Java Essentials,Java Programming...
# 8
http://forum.java.sun.com/thread.jspa?threadID=697574&tstart=0
CeciNEstPasUnProgrammeura at 2007-7-16 23:26:27 > top of Java-index,Java Essentials,Java Programming...
# 9
Thank you all for you reply's I'm a going to try and close this thread and repost in the JDBC forum. I believe it is better suited there.
hbskunka at 2007-7-16 23:26:27 > top of Java-index,Java Essentials,Java Programming...
# 10
*sigh* also...I guess things pile up at the bottom there is no way to close this thread and i just did a repost *sigh* , won't happen again
hbskunka at 2007-7-16 23:26:27 > top of Java-index,Java Essentials,Java Programming...