使用 MS-SQL Server 设置 Liquibase

发布于 2024-12-28 14:45:25 字数 600 浏览 2 评论 0原文

我正在 MVC3 SQL Server 2008 项目中使用 Liquibase (www.liquibase.org) 来管理数据库迁移/更改。然而,我遇到了第一个障碍:连接到 Microsoft SQL Server 实例。

我正在查看 liquibase 站点上的快速入门教程,但是将 mysql 替换为 sql server DB

我运行此命令:

liquibase --driver=sqljdbc.jar  --changeLogFile="C:\Temp\ChangeLog.xml"  --url="jdbc:sqlserver://localhost;databaseName=test"  --username=user --password=pass   migrate

并收到此错误:

Liquibase Update Failed: Cannot find database driver: sqljdbc.jar

我尝试添加 --classpath 指向 sqljdbc 驱动程序,但没有成功。

如何使用 liquibase 创建或更新 MS-SQL Server 数据库?

I am utilising Liquibase (www.liquibase.org) into our MVC3 SQL Server 2008 project to manage database migration/changes. However I'm stumbling on the first hurdle: Connecting to Microsoft SQL Server instance.

I am looking at the quick start tutorial on the liquibase site, but exchanging the mysql for sql server DB

I run this command:

liquibase --driver=sqljdbc.jar  --changeLogFile="C:\Temp\ChangeLog.xml"  --url="jdbc:sqlserver://localhost;databaseName=test"  --username=user --password=pass   migrate

And receive this error:

Liquibase Update Failed: Cannot find database driver: sqljdbc.jar

I have tried adding --classpath pointing to the sqljdbc driver with no luck.

How can I create or update an MS-SQL Server database with liquibase?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

殊姿 2025-01-04 14:45:25

创建一个名为 liquibase.properties 的属性文件,其中包含以下内容:

classpath=C:\\Program Files\\Microsoft SQL Server 2005 JDBC Driver\\sqljdbc_1.2\\enu\\sqljdbc.jar
driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
url=jdbc:sqlserver://localhost:1433;databaseName=test
username=myuser
password=mypass
changeLogFile=C:\\Temp\\ChangeLog.xml

当位于同一目录中时,liquibase 将使用此文件。对于简化命令行很有用。

数据库更新如下:

liquibase update

注意:

  • 我不是 SQL Server 用户,我从 Microsoft doco
  • “迁移”命令已被弃用。

Create a properties file called liquibase.properties containing the following:

classpath=C:\\Program Files\\Microsoft SQL Server 2005 JDBC Driver\\sqljdbc_1.2\\enu\\sqljdbc.jar
driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
url=jdbc:sqlserver://localhost:1433;databaseName=test
username=myuser
password=mypass
changeLogFile=C:\\Temp\\ChangeLog.xml

liquibase will use this file when located in the same directory. Useful to simplify the command-line.

Database is updated as follows:

liquibase update

Notes:

  • I'm not a SQL server user, I picked up the JDBC driver and URL details from Microsoft doco
  • The "migrate" command has been deprecated.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文