I'm using groovy gsql to query to Mysql database. Everything goes well on localhost (testing mode), unfortunately when I switching to remote db groovy don't query db.
Here is the code :
def sqlModule = Sql.newInstance("jdbc:mysql://localhost/module-test", "b", "b", "com.mysql.jdbc.Driver")
def sampleQuery(int dataset) {
def SampleQueryList = []
// Sql query
sqlModule.eachRow("""
select b.*
from dataset_group_set_details a, array_data b
where dataset_id = "${dataset}"
and group_set_id = 1
and a.array_data_id = b.array_data_id ;""")
{
def addSample= new Sample(it.toRowResult())
addSample.id = "${it.array_data_id}" as int
addSample.dateCreatedSample = dateFormat.parse("${it.date_created}")
addSample.tissueTypeId = "${it.tissue_type_id}" as int
...
// Add Sample to SampleList
SampleQueryList << addSample
}
return SampleQueryList
In localhost mode, "return SampleQueryList" return a good list, but in remote mode (ex : jdbc:mysql://192.168.209.32/module-test) my list is empty.
Note : Db in localhost and remote are equals. Also, I have no error in remote mode.
Why, in localhost mode groovy quering my db and not in remote mode ?
Any ideas ?