我基于this issue连接到SQL Server数据库。

driverClassName =“net.sourceforge.jtds.jdbc.Driver”
方言=“org.hibernate.dialect.SQLServerDialect”
url =“jdbc:jtds:sqlserver:// myurl:1433 / mydb”

我还添加了对buildConfig.groovy的依赖

runtime 'net.sourceforge.jtds:jtds:1.2.6'

不幸的是,控制台显示此错误:
| Error Resolve error obtaining dependencies: Could not find artifact net.sourceforge.jtds:jtds:zip:1.2.6 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
| Error Could not find artifact net.sourceforge.jtds:jtds:zip:1.2.6 in grailsCentral (http://repo.grails.org/grails/plugins)
| Run 'grails dependency-report' for further information.

最佳答案

dependencies {
   runtime 'net.sourceforge.jtds:jtds:1.2.6'
}

并不是
plugins{

  runtime 'net.sourceforge.jtds:jtds:1.2.6'
}

10-08 17:13