Stefano Scarpanti
Stefano Scarpanti

Reputation: 313

GRAILS 3 sql express: no driver

I recently installed grails 3.1.x and tested it with mysql. All right. When I moved similarly to MS express 2008 I found: No suitable driver found for jdbc:sqlserver. I am not able to find a correct MS dependency with maven so I downloaded basic jdbc4.jar from Microsoft server, but GRAILS does not know I have it; so

Thanks for any hint.

Upvotes: 2

Views: 835

Answers (2)

Stefano Scarpanti
Stefano Scarpanti

Reputation: 313

I got it! It is possible to use jtds driver, via Maven. So simply

  • put runtime 'net.sourceforge.jtds:jtds:1.3.1' in build.gradle file
  • and use correct syntax in Datasource like driverClassName = "net.sourceforge.jtds.jdbc.Driver" dialect = "org.hibernate.dialect.SQLServerDialect" url = "jdbc:jtds:sqlserver://127.0.0.1:1433;databaseName=db_name" username = "sa" password = "my_password"

I am not sure dialect is mandatory. Of course it is important to manage properly configuration of DB express to have port 1433 static, not dynamic which is default, and default user SA with password authentication. But it works, after many research days!

Upvotes: 1

Piotr Chowaniec
Piotr Chowaniec

Reputation: 1230

It is more gradle issue than grails. You must tell gradle where this driver is located. As it cannot be pulled from any maven repo it can be added as local file dependency. See the documentation.

Add to build.gradle something like this:

dependencies {
  compile files('libs/jdbc4.jar')
  //... already added dependencies 
}

Upvotes: 5

Related Questions