• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

No resultset

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a stored proc in sql server :
==========
@id varchar(20)
AS
BEGIN
declare @Compid varbinary(8)
begin
select @compid=cast(@compId1 as VarBinary(8))
print @compid
Select C.CompName
fromc_CompType T,
c_Company C
end
end
===========
my jdbc code in jsp is like this :with all other necessary things like try import et al

java.sql.CallableStatement cst1=con.prepareCall("{call Proc_Company_Get(?)}");
//cst1.registerOutParameter(2,Types.VARCHAR);
cst1.setString(1,"0x0000000000000DF4");


ResultSet rs1 = cst1.executeQuery();
while(rs1.next()){
out.print("sanjay2"+rs1.getString(1));
}

dsn is ok.The table gives result using dsn
proc runs fine in sql debugger
BUT
i am not getting resultset in jsp

i do not get an exception as well.
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by sanjay deshpande:
i have a stored proc in sql server :
==========
ResultSet rs1 = cst1.executeQuery();


Try using
ResultSet rs1 = cst1.execute() ;
Callable Statements should be called using this method in order to handle the subtelties of stored procedures.
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java.sql.CallableStatement cst1=con.prepareCall("{call Proc_Company_Get(?)}");
cst1.registerOutParameter(1,java.sql.Types.VARBINARY);
...........
//If U need this value.....
byte result[]=cst1.getBytes(1);
String str=new String(result);
System.out.println("result"+str);
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic