• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading data from database table that contains control characters.

 
O. Ziggy
Ranch Hand
Posts: 430
Android Debian VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok i am completely stuck with this one. I have the following bit of code that reads data from the an Oracle table (Note: This is running on Jdk 1.4.2)



The data in the MESSAGE_DATA column contains text but also control characters that separate data elements in the message (i.e (char)31, (char)29) and (char)28) .

What i am finding is that for some reason message.getString() is sometimes truncating the message. I can read the majority of messages but some of them are truncated. Am i supposed to be reading the data using a different method? If so how?

I have tried to use sqlplus to look at the data in the database and it is all there it is just truncated by the message.getString() method. I saw this when i tried to output the result i.e. System.out.println(message.getString()).

I ran an sql query using the length() function in Oracle and length("MESSAGE_DATA") returns 2032 whereas in java message.getString(1).length() returns 2000. Im not sure why this is happening.

Thanks

ps. Also posted on http://forums.oracle.com/forums/post!default.jspa?forumID=922
 
O. Ziggy
Ranch Hand
Posts: 430
Android Debian VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Update
---

Ok i might be on to something i think. I just tried a newer version of the JDBC driver and it seems to be working. The driver that was being used on an older version that was delivered for the jdk1.4 delivery. Does anyone know why this is the case? And also, does using a newer version of the jdbc driver have any implications especially given the fact that the application is running on JDK 1.4. The oracle version is 10.1.0.3.0

Thanks
 
O. Ziggy
Ranch Hand
Posts: 430
Android Debian VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I am not sure if this is any helpfull but here are the versions of the two JDBC drivers.

The JDBC driver that does not work



The JDBC Driver that does work

 
Rob Spoor
Sheriff
Pie
Posts: 20493
54
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excellent work on finding the solution yourself, and thanks for sharing it with us!

I'll move this thread to our JDBC forum so anybody who encounters the same problem in the future can find it a little bit faster.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic