有没有办法用SQL Server JDBC驱动程序显示PRINT结果? [英] Is there a way to display PRINT results with SQL server JDBC driver?
本文介绍了有没有办法用SQL Server JDBC驱动程序显示PRINT结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我的存储过程中有一个print语句:
If my stored procedure has a print statement inside it:
print 'message'
有没有办法在通过JDBC连接到SQL Server 2008的java程序中获取输出?
Is there a way to fetch the output in java program that connects to SQL Server 2008 through JDBC?
此外,还有一个危险是 print
从JDBC应用程序调用时,为调试而留下的消息是否会关闭连接?
Also, is there a danger that print
messages left for debugging would shutdown connection when called from JDBC application?
推荐答案
是的,有: https://dba.stackexchange。 com / a / 44373/5457
Statement stmt = ...;
stmt.execute("some sql statement");
SQLWarning warning = stmt.getWarnings();
while (warning != null) {
System.out.println(warning.getMessage());
warning = warning.getNextWarning();
}
这篇关于有没有办法用SQL Server JDBC驱动程序显示PRINT结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文