android - Getting print messages from sqlserver to java application -
i have stored procedure prints simple string:
create proc proc1 print 'hello world !'
i have android application uses servlet (written in java) making connection sql server data base. next code inside servlet:
class.forname("sun.jdbc.odbc.jdbcodbcdriver"); connection con1 = drivermanager.getconnection("jdbc:odbc:abc"); callablestatement cstmt=con1.preparecall("{call proc1}"); cstmt.execute();
it works fine. procedure being activated now, want print message 'hello world !' following code doesn't work, , sqlwarning gets null:
sqlwarning warning = cstmt.getwarnings(); while (warning != null) { system.out.println(warning.getmessage()); warning = warning.getnextwarning(); }
my question how can thess print messages? p.s using raiserror instead of print didn't work well. know option of output parameters (i investigated subject week). permission ask option.
i'm not sure how implement in java. however, this article (not accepted answer) hints print works differently , doesn't produce "warning"s. can consider using raiserror instead. well, blog article describes how use sqlinfomessageeventhandler information messages.
Comments
Post a Comment