使用MS-SQL Server设置Liquibase [英] Setting up Liquibase with MS-SQL Server
问题描述
我正在利用Liquibase(www.liquibase.org)进入我们的MVC3 SQL Server 2008项目来管理数据库迁移/更改.但是,我遇到了第一个障碍:连接到Microsoft 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.
我正在看liquibase网站上的快速入门教程,但是将mysql替换为sql server DB
I am looking at the quick start tutorial on the liquibase site, but exchanging the mysql for 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驱动程序,但是没有运气.
I have tried adding --classpath pointing to the sqljdbc driver with no luck.
如何使用liquibase创建或更新MS-SQL Server数据库?
How can I create or update an MS-SQL Server database with liquibase?
推荐答案
创建一个名为 liquibase.properties 的属性文件,其中包含以下内容:
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将使用此文件.对简化命令行很有用.
liquibase will use this file when located in the same directory. Useful to simplify the command-line.
数据库更新如下:
liquibase update
注意:
这篇关于使用MS-SQL Server设置Liquibase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!