My favorites | Sign in
Project Home Downloads Issues Source
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 692: sql text newlines in mapping file when mybatis used with db2
  Back to list
Status:  WontFix
Owner:  ----
Closed:  Oct 2012

Sign in to add a comment
Reported by, Oct 11, 2012
What version of the MyBatis are you using?

Please describe the problem.  Unit tests are best!
I used mybatis with db2 8.1, there is problems when sql text appears newlines in mapping file.

What is the expected output? What do you see instead?

Can you provide stack trace, logs, error messages that are displayed?
logs says "illegal tokens"

Please provide any additional information below.
I modified org.apache.ibatis.builder.xml.dynamic.TextSqlNode's constructor as:

  public TextSqlNode(String text) {
    this.text = text.replaceAll("\r|\n", " "); 
then I export new jar file put it into my project, it works well;

Oct 27, 2012
Project Member #1 eduardo.macarron
Sounds extrange because I use db2 without problems.

Anyway, try with a CDATA or cutting the sentence in a different place... MyBatis tries not to alter the SQL you wrote.
Oct 27, 2012
Project Member #2 eduardo.macarron
(No comment was entered for this change.)
Status: WontFix
Nov 5, 2012
Thanks that!
Default newlines likes '\n' is not be recognized in db2.
I must input 'db2 -t' command before used db2 client access db2 server.
Thus, Mybatis has to send SQL text without newlines to db2 server. 
Sign in to add a comment

Powered by Google Project Hosting