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!

Have you added the jar to tomcat/libs directory?

The Connector method adds and uses it from the connector, however any other method requires you to add it to the tomcat/lib path.

regards
Seán

PS: If this reply answers your question, please mark 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

The answer of Sean with the msdn link is the apropiate answer:

http://community.bonitasoft.com/answer-execute-stored-procedure-0#comment-6712

I don’t know how to mark it as resolved.

Hi, /josemariaarbesu

Can you tell, how you configure your project to execute stored procedure? Or maybe you found some guide?

Thanks

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

Many thanks, Sean.

I tried sourceforge because i find as a solution for this error in other forum.

I tried with the msdn link that you put and it’s ok now!!

Regards

You’ve done that by ticking the mark tick mark :slight_smile:

regards