HFernandez
11 years agoNew Contributor
Stored Proc, DYNAMIC SQL returns no rows
This is a bit confusing to explain, but here I go. I have an MS SQL Stored PROC that I can run with a dataSource test step. It will return rows if the PROC does NOT have any dynamic SQL embedded in it. So if there is a simple table select, it works fine. If you add dynamic SQL like:
--*******************************************************
SET @SQL = 'INSERT INTO #FIG (CHAPTER_NO)
(
SELECT F.CHAPTER_NO FROM ' + @SchemaName+'.TABLENAME AS F
)'
EXEC sp_executesql @SQL
SELECT CHAPTER_NO FROM #FIG
--*******************************************************
It returns no rows...
This Statement above uses dynamic SQL and temporary tables. It no longer works with default JDBC drivers.
viewtopic.php?f=2&t=8198
viewtopic.php?f=4&t=3252&p=11527&hilit=add+driver&sid=9acaa68df72a04ba6e8cd1500bd77886#p11527
viewtopic.php?f=5&t=22836&p=52220&hilit=stored+Procedure&sid=5febd570305662894ef672099b6f26ce#p52220
Why would dynamic SQL affect the JDBC drivers? They should not care what the PROC does, only its response. I have checked the response with other software drivers and it is the same for static and dynamic SQL.
Anyone else with this problem?
Should I install the net.sourceforge.jtds.jdbc.Driver ?
How do i register this drive and get it to show up on the list of available drivers in the SOAPUI application?
I am able to call another driver with groovy, but it is not on the SOAPUI dropdown lists...
//*******************************************************
import groovy.sql.Sql
com.eviware.soapui.support.GroovyUtils.registerJdbcDriver( "net.sourceforge.jtds.jdbc.Driver")
String csuf = "";
def list= []
String pP_Model = testRunner.testCase.testSuite.project.getPropertyValue( "TestModel" )
String pP_SqlServer = testRunner.testCase.testSuite.project.getPropertyValue( "SqlServer" )
String pP_SqlUser = testRunner.testCase.testSuite.project.getPropertyValue( "SqlUser" )
String pP_SqlPwd = testRunner.testCase.testSuite.project.getPropertyValue( "SqlPwd" )
//log.info(pP_Model)
//log.info(pP_SqlServer)
//log.info(pP_SqlUser)
//log.info(pP_SqlPwd)
def sql = Sql.newInstance("jdbc:jtds:sqlserver:" + pP_SqlServer, pP_SqlUser, pP_SqlPwd, "net.sourceforge.jtds.jdbc.Driver")
def res = sql.eachRow("exec get_available_Figure_for_Model '" + pP_Model + "' ") {
log.info( it.toRowResult().values())
csuf = it.toRowResult().values()
}
//*******************************************************
This driver does not seem to have issues with dynamic SQL or is there a bug with the datasource steps?
thanks for your help...
Stephen Love
Software Developer
cdgnow.com
--*******************************************************
SET @SQL = 'INSERT INTO #FIG (CHAPTER_NO)
(
SELECT F.CHAPTER_NO FROM ' + @SchemaName+'.TABLENAME AS F
)'
EXEC sp_executesql @SQL
SELECT CHAPTER_NO FROM #FIG
--*******************************************************
It returns no rows...
This Statement above uses dynamic SQL and temporary tables. It no longer works with default JDBC drivers.
viewtopic.php?f=2&t=8198
viewtopic.php?f=4&t=3252&p=11527&hilit=add+driver&sid=9acaa68df72a04ba6e8cd1500bd77886#p11527
viewtopic.php?f=5&t=22836&p=52220&hilit=stored+Procedure&sid=5febd570305662894ef672099b6f26ce#p52220
Why would dynamic SQL affect the JDBC drivers? They should not care what the PROC does, only its response. I have checked the response with other software drivers and it is the same for static and dynamic SQL.
Anyone else with this problem?
Should I install the net.sourceforge.jtds.jdbc.Driver ?
How do i register this drive and get it to show up on the list of available drivers in the SOAPUI application?
I am able to call another driver with groovy, but it is not on the SOAPUI dropdown lists...
//*******************************************************
import groovy.sql.Sql
com.eviware.soapui.support.GroovyUtils.registerJdbcDriver( "net.sourceforge.jtds.jdbc.Driver")
String csuf = "";
def list= []
String pP_Model = testRunner.testCase.testSuite.project.getPropertyValue( "TestModel" )
String pP_SqlServer = testRunner.testCase.testSuite.project.getPropertyValue( "SqlServer" )
String pP_SqlUser = testRunner.testCase.testSuite.project.getPropertyValue( "SqlUser" )
String pP_SqlPwd = testRunner.testCase.testSuite.project.getPropertyValue( "SqlPwd" )
//log.info(pP_Model)
//log.info(pP_SqlServer)
//log.info(pP_SqlUser)
//log.info(pP_SqlPwd)
def sql = Sql.newInstance("jdbc:jtds:sqlserver:" + pP_SqlServer, pP_SqlUser, pP_SqlPwd, "net.sourceforge.jtds.jdbc.Driver")
def res = sql.eachRow("exec get_available_Figure_for_Model '" + pP_Model + "' ") {
log.info( it.toRowResult().values())
csuf = it.toRowResult().values()
}
//*******************************************************
This driver does not seem to have issues with dynamic SQL or is there a bug with the datasource steps?
thanks for your help...
Stephen Love
Software Developer
cdgnow.com