Problem with special characters

Hi,

i tried to generate a changelog from an existing database (mssql 2000, very hard to change cuz of poorly legacy software).
I’ve used the ms jdbc drivers for msql 2000 and 2005 with the current liquibase version 1.9.3

Unfortunately liquibase quit the task with the message:
liquibase.exception.JDBCException: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name ‘FBL’.

The name of the column is “FBL-Street”, so i assume its a problem with “special” characters like " "  “,”  “-” and so on
Another database without this “corrupted” names worked well

i have no clue how to work around this problem, there is nothing helpful to configure in the connection string

Is there a way to read this database without changing it?

greetings

Marco

Marco,

generally speaking such stuff should be escaped. For example select [FBL-street] from [city-address-of-Fbl] does not break sql syntax.
And liquibase try to escape ones. If not this is bug and should be filed in jira.
What exactly you doing?

Cheers, Oleg

Hi Oleg,

i just start “java -jar liquibase-1.9.3.jar generatechangelog” on the command shell, with the proper configuration in the file liquibase.properties:

classpath=lib/sqljdbc.jar;
changeLogFile=Changelog.xml
username=*******
password=*******
logLevel=finest
logFile=log.txt
url=jdbc:sqlserver://localhost;databaseName=mp;

Yeah this names should be escaped for sure, but how?

Is there anyone to confirm this behavior as a bug?

I think it is a bug in 1.9.3, but it has been fixed in trunk for the upcoming 2.0.  I ran into it myself lately :) 

I’ll backport the fix to the 1.9 branch and put a snapshot up for you to try.  I’ll let you know when it’s ready.

Nathan

I guess I had put a fix in already, but probably post-1.9.3.  Try downloading http://www.liquibase.org/liquibase-SNAPSHOT.jar and see if that helps you.

Nathan

Originally posted by: Nathan
I guess I had put a fix in already, but probably post-1.9.3.  Try downloading http://www.liquibase.org/liquibase-SNAPSHOT.jar and see if that helps you.

Nathan

Hi Nathan,

thank you for your quick response.
It worked well with your posted snapshot.

I found another bug that I could solve by editing the changelog

The generated changelog misses spaces in some cases - eg.

select fieldname as modifiedfieldnameFrom tablename

This seems to concern alot of keywords (from, group, where, union and order)

Marco

Do you have an actual example of a bad part of the generated changelog and the sql it is generating? 

windows notepad causes the problem

notepad removes any occurrences of /u000d /u000d /u000a or \r\n\n

i think its a line break inconsistence thing
other editors (visual studio, cooktop) also asking to correct the line breaks