473,396 Members | 2,057 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

2nd try: embedded newlines in SQL in Java/JDBC v8 changed things?

Maybe I'm just being dense, but this seems like a legitimate question.
Here's my 2nd try. Can someone please comment? Blair? Serge?
-----------------------------------------------------
Under DB2 v7, while writing JDBC/Java/SQL code to query the database,
I could embed newlines in my SQL, ala:

ResultSet rs = stmt.executeQuery("select blah \n"
+"from blahblah") ;
This worked fine.

However, if I try this under DB2 v8, I get:

SQL Error Code -7, SQL State 42601, The character "
" following "select blah " is not valid.

Why is this?

And before anyone asks: the reason I embed newlines in SQL is so that
the offending SQL printed in errors/exceptions is across multiple
lines and is easier to read.

And along the same lines: many of my developers, while writing
JDBC/Java/SQL code to query the database (see above), would append a
semi-colon to the end of SQL statements. In DB2 v7 this worked fine.
Under v8 you get:
SQL Error Code -104, SQL State 42601, An unexpected token ""
was found following "". Expected tokens may include: "lah from
blah". Why?

TIA

Allen
Nov 12 '05 #1
0 4929

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Melanie | last post by:
Hi For my company I work for I have to read and process files from Excel, Access or MS SQL. This way is no poblem. I use the JDBC/ODBC bridge to make a delimited file (*.csv) and work with that....
1
by: aj | last post by:
RH Linux AS 2.1 DB2 v8 UDB WSE Hello All: I am testing my soon-to-be-in-production DB2 v8 **FP 5** server. In a test java program, I just used the DB2 v8 **FP 4** db2jcc.jar file (and the...
16
by: Arun | last post by:
I have a query.I am a freah engineering graduate and have 2 job offers.One is with LG Electronics Korea where I 'll be working in korea as a software Engineer in Embedded systems exclusively at...
3
by: info | last post by:
Hi, how could I do an export of tables via Java / JDBC. There are very big tables. I thought about: EXPORT TO c:\aa.ixf OF ixf SELECT * FROM TEST1 How could I call this from JDBC / Java? ...
2
by: asufty888 | last post by:
Hello. I am having trouble finding a descent API for executing TSQL via JDBC. I have tried the Microsoft driver AND the JDTS driver's but get the same syntax errors. I am hoping there is a good...
3
by: ashokformac | last post by:
how to connect remote sql server database form mac os using jdbc driver please help me if any one knows the answer ........
0
by: hosesurya | last post by:
Hello, all I am a newbie in Java + DB2 (and thescripts.com) =P I want to ask: How can I get (list) Databases name / aliases in DB2 using Java? I am using windows XP DB2 v8.1.7.445 JDK 1.4.1...
3
by: MoleHillRocker | last post by:
Hello forum! I am stuck with this problem since 2 days now, and have no idea how to solve my problem. I have a txt-file which looks like the following:...
3
by: brendanmcdonagh | last post by:
Hi all, I have been working with java on a database program that connects via jdbc odbc access driver on my xp desktop. It is working fine but I'm installing it on 3 pc's tomorrow so testing it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.