Execute a stored procedure
Good Morning,
i need to execute a stored procedure that returns a row. The stored procedure requires one string parameter, and returns a row. Then, i want to save the values of the row (5 columns) in independent variables. What is the best way to do this?
I'm doing it in a groovy script but it is giving me the following error:
No suitable driver found for jdbc:sqlserver://hostSql;database=DBName.
I'm using this code in the groovy script:
`import groovy.sql.Sql;
def sql = Sql.newInstance(
"jdbc:sqlserver://hostSql:port;database=dbName",
'userName', 'userPass',
'com.microsoft.sqlserver.jdbc.SQLServerDriver')
sql.call('{? = call spName(?,?)}',[
Sql.INTEGER, 'param1Value'],{
spResult ->
if(spResult == 0){
assert 25 == 25
}
})`
I have a DataBase connector, a Microsoft SQL Server 2008 JDBC 4 DataBase Query connector, and it works well in the same diagram. I don't know what is the problem with the groovy script.
Can someone help me?
Thanks!
The answer of Sean with the msdn link is the apropiate answer:
http://community.bonitasoft.com/answer-execute-stored-procedure-0#commen...
I don't know how to mark it as resolved.
Thanks, Sean.
I put the sqljdbc4.jar in the tomcat/library and i still have the error.
I tried also this code:
def sql = BonitaSql.newInstance(
"jdbc:jtds:sqlserver://hostSql:port/DBName",
"userName", "userPass",
new net.sourceforge.jtds.jdbc.Driver())
and it's giving me a similar error:
unable to resolve class net.sourceforge.jtds.jdbc.Driver
Comments
And why are you trying to use sourceforge? It's sqlserver you should be using.
Have a look here...
https://msdn.microsoft.com/en-us/library/aa342339(v=sql.110).aspx
Comments
Hi, /josemariaarbesu
Can you tell, how you configure your project to execute stored procedure? Or maybe you found some guide?
Thanks