Execute a stored procedure

1
0
-1

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!

Comments

Submitted by Xvz88 on Tue, 08/09/2016 - 21:09

Hi, /josemariaarbesu

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

Thanks

3 answers

1
0
-1
This one is the BEST answer!

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.

Comments

Submitted by Sean McP on Mon, 05/30/2016 - 16:17

You've done that by ticking the mark tick mark :)

regards

1
0
-1

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

Submitted by Sean McP on Mon, 05/30/2016 - 11:20

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

Submitted by josemaria.arbesu on Mon, 05/30/2016 - 12:28

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

1
0
-1

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.

Notifications