Home » Developer & Programmer » JDeveloper, Java & XML » Reading data from database table that contains control characters. (JDK1.4 Oracle 10.1)
Reading data from database table that contains control characters. [message #505274] Sun, 01 May 2011 12:21 Go to next message
ziggy25
Messages: 206
Registered: July 2005
Senior Member
I have the following bit of code that reads data from the an Oracle table (Note: This is running on Jdk 1.4.2)

ResultSet message = messageStatement.executeQuery(getMsgSql);
String messageData = message.getString("MESSAGE_DATA");


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

[Updated on: Sun, 01 May 2011 12:22]

Report message to a moderator

Re: Reading data from database table that contains control characters. [message #505275 is a reply to message #505274] Sun, 01 May 2011 12:23 Go to previous messageGo to next message
ziggy25
Messages: 206
Registered: July 2005
Senior Member
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
Re: Reading data from database table that contains control characters. [message #505277 is a reply to message #505275] Sun, 01 May 2011 13:12 Go to previous messageGo to next message
ziggy25
Messages: 206
Registered: July 2005
Senior Member


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

=====  Database info =====
DatabaseProductName: Oracle
DatabaseProductVersion: Oracle Database 10g Release 10.1.0.3.0 - 64bit Production
=====  Driver info =====
DriverName: Oracle JDBC driver
DriverVersion: 8.0.5.2.0
DriverMajorVersion: 8
DriverMinorVersion: 0


The JDBC Driver that does work

=====  Database info =====
DatabaseProductName: Oracle
DatabaseProductVersion: Oracle Database 10g Release 10.1.0.3.0 - 64bit Production
=====  Driver info =====
DriverName: Oracle JDBC driver
DriverVersion: 10.2.0.1.0
DriverMajorVersion: 10
DriverMinorVersion: 2
Re: Reading data from database table that contains control characters. [message #505281 is a reply to message #505277] Sun, 01 May 2011 13:42 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
1) Using newer JDBC driver you have a better change to have less bugs
2) Using an obsolete and no more supported Oracle version will let you alone on many problems.

Regards
Michel
Re: Reading data from database table that contains control characters. [message #505282 is a reply to message #505281] Sun, 01 May 2011 13:56 Go to previous messageGo to next message
ziggy25
Messages: 206
Registered: July 2005
Senior Member
Michel Cadot wrote on Sun, 01 May 2011 13:42
1) Using newer JDBC driver you have a better change to have less bugs
2) Using an obsolete and no more supported Oracle version will let you alone on many problems.

Regards
Michel


Does this mean that i can use the jdbc driver (shown here http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html) with a higher version number than the database version? I thought the jdbc version had to match the database version.

Thanks
Re: Reading data from database table that contains control characters. [message #505284 is a reply to message #505282] Sun, 01 May 2011 15:38 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
It is hard to tell you as Oracle will never certicy that this version of the driver will work with your version of database as this latter one is no more supported.

In the Compatibility matrices and differences between editions you will find the Metalink note that will give the compatibility matrix between versions.
However, therorically, if you use the thin JDBC driver, you can use any version.

Regards
Michel

[Updated on: Sun, 01 May 2011 15:39]

Report message to a moderator

Previous Topic: INSERTCHILDXML CLOB Error(3 Merged)
Next Topic: XMLTYPE issue in 10g
Goto Forum:
  


Current Time: Thu Mar 28 14:02:46 CDT 2024