A few MSSQL Issues?

I’m using liquibase via ANT to dump changelogs like so:

<generateChangeLog

            outputFile=“diffs/dump.xml”
            driver="${database.driver}"
            url="${dealer.database.url}"
            username="${database.username}"
            password="${database.password}"
            classpathref=“classpath”
            />

I have 2 errors that come up:

  1. [generateChangeLog] Unknown Data Type: -9 (nvarchar).  Assuming it does not take parameters
    This looks to be a problem, if it’s not going to bring over the parameters, all my nvarchar columns will be the default length. This error doesn’t stop the dump from happening.

  2. On another legacy database, we have some really ugly column names with spaces and other characters. This is legal in SQL server, as long as you escape the column names with []'s. I see in the liquibase source this should happen, but when I run the diff, it complains with:

build.xml:39: liquibase.exception.JDBCException: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: Incorrect syntax near ‘SEG’.

I traced this via SQL Profiler, and found the statement it gets stuck on is:

SELECT PROD GRP SEG DESC: FROM [Test Table] WHERE 1 = 0

[PROD GRP SEG DESC:] is the name of a column…

I searched for “1 = 0” in the source code, and found it in AbstractDatabase.java, and appears to be calling the escapeColumnName method of AbstractDatabase instead of the MSSQLDatabase method (which WOULD escape the column name properly)

Any chance there’s an easy fix for these issues?

I committed a fix for these to the 1_9 branch.  Let me know if you need me to do a build or if you can build it.

Nathan

If you could do a build, I would very much appreciate it, I’m still having trouble getting it to build on my machine. Thanks!

I put a new build up on http://www.liquibase.org/liquibase-SNAPSHOT.jar

Let me know if it helps or not.

Nathan

I think the jar is corrupt - getting an “invalid CEN header (bad signature)” method when I try to load the ant taskdef…

I re-uploaded it.  Try it again

Nathan

That worked like a charm! Thanks for your help.

SNAPSHOT worked for me too. Got the same issue with ntext though. when is the SNAPSHOT being released to a maven rep? Or is this going to be in 2.0.0 ?
“Unknown Data Type: -16 (ntext). Assuming it does not take parameters.”, just have a problem with liquibase make just “ntext” from what should be “nvarchar(max)”…

Glad to hear it worked.  It will go out with 2.0, and with 1.9.5. 

Is the ntext error on oracle as well or something else?

Nathan

can’t tell for oracle, just using mssql. the issue with ntext is that it’s deprecated since 2005…
thanks for all your answers and thanks for a nice tool…

ok.  I can add a check for the ntext type for mssql and make sure it gets the parameter.  Thanks

Nathan