Grails Sql Server Express

Joh*_*ohn 2 grails datasource sql-server-express

我想要一些有关设置Grails与SQL Server Express一起使用的帮助。我知道我必须更改数据源,但是我不确定该怎么做,也无法在网络上找到更新的信息。

Dón*_*nal 5

您需要在以下位置更改数据源设置 grails-app/conf/DataSource.groovy

dataSource {

    // Change the values of these properties to the username, password and hostname
    // for your SQL Server database
    username = "sa"
    password = ""
    url = "jdbc:sqlserver://localhost:1433;databaseName=your_database_name_here"

    driverClassName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    dialect = "org.hibernate.dialect.SQLServerDialect"
}
Run Code Online (Sandbox Code Playgroud)

您需要通过将SQL Server JDBC驱动程序复制到libgrails应用程序的目录或将其配置为运行时依赖项来确保SQL Server JDBC驱动程序在类路径中BuildConfig.groovy