Forum Discussion
Hi,
I can't coment on the the driver file suitability, as I dont have MS SQLServer to test with, but the location of where you have copied the driver jar sounds like it could be wrong - normally it should be copied to:
bin/ext
This should be the location for all external libraries (jar files) that you want to be added to the SoapUI class path.
As for the code, I can't see the contents of that connectDataBase() method, but here is an example of a working Groovy SQL script for the H2 DB, should be very similar, just a different driver string:
import groovy.sql.Sql import org.h2.Driver com.eviware.soapui.support.GroovyUtils.registerJdbcDriver("org.h2.Driver") def db = Sql.newInstance("jdbc:h2:mem:test", "org.h2.Driver") db.eachRow("select * from quotes"){invoice-> log.info invoice.toString() }
Hope this helps,
Cheers,
Rupert
no that didnt help much :smileysad:
def dbDriver = "com.microsoft.sqlserver.jdbc.SQLServerDriver ,org.h2.Driver"
def db = Sql.newInstance(dburl, dbUserName, dbPassword, dbDriver)
could this syntax be wrong ?
- rupert_anderson9 years agoValued Contributor
Hi,
OK, well at least if you put your driver in bin/ext, then it should be in the right place.
Turning to the code, again you should use the org.h2.Driver in that first statement.
I found this SQL Server example, see if this helps:
http://stackoverflow.com/questions/1400280/connecting-groovy-to-sql-server
?
Cheers,
Rup
- rupert_anderson9 years agoValued Contributor
This one might also be useful, as it mentions a particular driver version:
https://www.ntosic.net/2015/02/groovy-connect-to-sql-server-and-execute-stored-procedure/
Related Content
Recent Discussions
- 15 years ago