Discussion:
[Liquibase-user] New Topic: 2.0 RC6 generateChangeLog with MSSQL 2008 R2
Liquibase Community Forum
2010-10-28 21:18:08 UTC
Permalink
A new topic, '2.0 RC6 generateChangeLog with MSSQL 2008 R2', has been made on a board you are watching.

You can see it at
http://liquibase.org/forum/index.php?topic=762.new#new

The text of the topic is shown below:

Hello,

I am trying to run generateChangeLog against a SQL 2008 R2 installation and it is failing trying to run this command on the DB:

Code:
SELECT OBJECT_DEFINITION(OBJECT_ID)
FROM sys.objects
where Type = 'v'
AND UPPER(name)='VIEWNAME'
AND SCHEMA_ID = 'dbo'

Exception:
Caused by: java.sql.SQLException: Conversion failed when converting the varchar value 'dbo' to data type int.

The issue here is that SCHEMA_ID on sys.objects is an int, not a string. the dbo schema is represented by a 1..

I did some quick searches on google, this forum and JIRA and didn't see anything that related.

I am using jtds-1.2.5 to connect to SQL and I have tried this with 2.0RC6.

This command runs fine under 1.9.5, however it only seems to grab the dbo schema (but I think that is a known issue).

Jim

Unsubscribe to new topics from this board by clicking here: http://liquibase.org/forum/index.php?action=notifyboard;board=1.0

Regards,
The Liquibase Community Forum Team.
Baker,Jonathan
2010-10-29 16:12:26 UTC
Permalink
I have some test cases that I use in a presentation I am giving that
were using liquibase 1.9.5. I decided that I would try to update them
to the 2.0-rc6 code so that when I next give the presentation (in
January 2011) I will be using the most up-to-date version of liquibase.

I changed the Liquibase construction to use the ResourceAccessor
abstraction instead of the FileOpener abstractions, and made sure that
I'm using a JdbcConnection to talk to a mysql database running on my
workstation.

I am using Spring's Junit 4 integration to run a junit test that creates
some table structure in a @Before method using the liquibase.Liquibase
object, and then uses that same object in an @After method to rollback
the table structure created in the @Before.

When I run my test, the test does what is supposed to, and all of the
assertions pass. Then in the @After method when the Liquibase object
attempts to rollback the changelist, we get a null pointer and blow up.
The NullPointer occurs in ChangeSet, line 308 where it is checking the
execType of the ranChangeSet to see if it has been EXECUTED or RERAN.
Unfortunately at this time, the execType is null, so the rollback blows
up.

I have attached my dao class, unit test class, as well as my spring
configuration file, and my liquibase change set for debugging purposes.
Here is the relevant stack trace from my test run.

Oct 29, 2010 12:11:46 PM liquibase.logging.jvm.JavaUtilLogger info
INFO: Successfully released change log lock
Oct 29, 2010 12:11:46 PM
org.springframework.test.context.transaction.TransactionalTestExecutionL
istener endTransaction
INFO: Rolled back transaction after test execution for test context
[[***@19ea173 testClass =
PhoneBookDAOFreshStandAloneDBIntegrationTest, locations =
array<String>['classpath:/DatabaseTesting/PhoneBookDAOFreshStandAloneDBI
ntegrationTest-context.xml'], testInstance =
***@179a49f,
testMethod = ***@PhoneBookDAOFreshStandAloneDBIntegrationTest,
testException = liquibase.exception.RollbackFailedException:
java.lang.NullPointerException]]

liquibase.exception.RollbackFailedException:
java.lang.NullPointerException
at liquibase.changelog.ChangeSet.rolback(ChangeSet.java:340)
at
liquibase.changelog.visitor.RollbackVisitor.visit(RollbackVisitor.java:2
3)
at
liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
at liquibase.Liquibase.rollback(Liquibase.java:249)
at
DatabaseTesting.PhoneBookDAOFreshStandAloneDBIntegrationTest.drop_tables
(PhoneBookDAOFreshStandAloneDBIntegrationTest.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMet
hod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallab
le.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMetho
d.java:41)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:
37)
at
org.springframework.test.context.junit4.statements.RunAfterTestMethodCal
lbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
at
org.springframework.test.context.junit4.statements.SpringRepeat.evaluate
(SpringRepeat.java:72)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild
(SpringJUnit4ClassRunner.java:240)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner
.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at
org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at
org.springframework.test.context.junit4.statements.RunBeforeTestClassCal
lbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at
org.springframework.test.context.junit4.statements.RunAfterTestClassCall
backs.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(Spri
ngJUnit4ClassRunner.java:180)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaT
estRunner.java:94)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUni
tStarter.java:192)
at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
Caused by: java.lang.NullPointerException
at liquibase.changelog.ChangeSet.rolback(ChangeSet.java:310)
... 34 more



Also, on a very trivial sidenote, liquibase.changelog.ChangeSet.rolback
is misspelled. It should have 2 Ls not one.


JB

"The best way to predict the future is to invent it."
- Alan Kay
solidjb
2010-11-01 16:38:49 UTC
Permalink
I have some test cases that I use in a presentation I am giving that were
using liquibase 1.9.5. I decided that I would try to update them to the
2.0-rc6 code so that when I next give the presentation (in January 2011) I
will be using the most up-to-date version of liquibase.

I changed the Liquibase construction to use the ResourceAccessor abstraction
instead of the FileOpener abstractions, and made sure that I'm using a
JdbcConnection to talk to a mysql database running on my workstation.

I am using Spring's Junit 4 integration to run a junit test that creates
some table structure in a @Before method using the liquibase.Liquibase
object, and then uses that same object in an @After method to rollback the
table structure created in the @Before.

When I run my test, the test does what is supposed to, and all of the
assertions pass. Then in the @After method when the Liquibase object
attempts to rollback the changelist, we get a null pointer and blow up. The
NullPointer occurs in ChangeSet, line 308 where it is checking the execType
of the ranChangeSet to see if it has been EXECUTED or RERAN. Unfortunately
at this time, the execType is null, so the rollback blows up.

I have attached my dao class, unit test class, as well as my spring
configuration file, and my liquibase change set for debugging purposes.
Here is the relevant stack trace from my test run.

Oct 29, 2010 12:11:46 PM liquibase.logging.jvm.JavaUtilLogger info
INFO: Successfully released change log lock Oct 29, 2010 12:11:46 PM
org.springframework.test.context.transaction.TransactionalTestExecutionListener
endTransaction
INFO: Rolled back transaction after test execution for test context
[[***@19ea173 testClass =
PhoneBookDAOFreshStandAloneDBIntegrationTest, locations =
array<String>['classpath:/DatabaseTesting/PhoneBookDAOFreshStandAloneDBIntegrationTest-context.xml'],
testInstance =
***@179a49f,
testMethod = ***@PhoneBookDAOFreshStandAloneDBIntegrationTest,
testException = liquibase.exception.RollbackFailedException:
java.lang.NullPointerException]]

liquibase.exception.RollbackFailedException: java.lang.NullPointerException
at liquibase.changelog.ChangeSet.rolback(ChangeSet.java:340)
at
liquibase.changelog.visitor.RollbackVisitor.visit(RollbackVisitor.java:23)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
at liquibase.Liquibase.rollback(Liquibase.java:249)
at
DatabaseTesting.PhoneBookDAOFreshStandAloneDBIntegrationTest.drop_tables(PhoneBookDAOFreshStandAloneDBIntegrationTest.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:37)
at
org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
at
org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at
org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at
org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:94)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
Caused by: java.lang.NullPointerException
at liquibase.changelog.ChangeSet.rolback(ChangeSet.java:310)
... 34 more



Also, on a very trivial sidenote, liquibase.changelog.ChangeSet.rolback is
misspelled. It should have 2 Ls not one.

http://old.nabble.com/file/p30106314/phonebook-initial-load.sql
phonebook-initial-load.sql
http://old.nabble.com/file/p30106314/phonebook-create-changelog.xml
phonebook-create-changelog.xml
http://old.nabble.com/file/p30106314/PhoneBookDAOFreshStandAloneDBIntegrationTest-context.xml
PhoneBookDAOFreshStandAloneDBIntegrationTest-context.xml
http://old.nabble.com/file/p30106314/PhoneBookDAOFreshStandAloneDBIntegrationTest.java
PhoneBookDAOFreshStandAloneDBIntegrationTest.java
http://old.nabble.com/file/p30106314/PhoneBookDAO.java PhoneBookDAO.java
--
View this message in context: http://old.nabble.com/NullPointer-trying-to-rollback-changelist-tp30106314p30106314.html
Sent from the LiquiBase - User mailing list archive at Nabble.com.
Loading...