This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JDBC and the fly likes Control character when retrieving a field from an Oracle Array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Control character when retrieving a field from an Oracle Array" Watch "Control character when retrieving a field from an Oracle Array" New topic
Author

Control character when retrieving a field from an Oracle Array

Ben George
Greenhorn

Joined: Nov 26, 2004
Posts: 3
Hi,
I am connecting to an Oracle 9i DB using a web service and fetching data to populate and XML file. The server used here is WAS 6.1.
There seems to be an issue with the value returned from a VARCHAR2 field. The data in this field has an asterisk(*).

We have a separate application calling this field and we get the value on the screen as ERROR*. When we directly call the query to the DB we get the value back correctly as ERROR*.

The webservice gets the record as an array from a stored procedure.
The error:
We are getting all the values correctly, except the value with the *. the value being returned here is 'ERROR'(without the quotes). There seems to be a control character at the end. When we put it in in the XML and do a system.out we can see the character showing up as ERROR& #25 (without the space in between, this is getting translated here on the screen).

We are using WSJdbcUtil.getNativeConnection method to get the array back from the stored procedure. Everything except this is working fine. And due to this charater, the XML validation fails.

Thanks in advance!

[ August 21, 2008: Message edited by: Ben George ]

[ August 21, 2008: Message edited by: Ben George ]

[ August 21, 2008: Message edited by: Ben George ]
[ August 21, 2008: Message edited by: Ben George ]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38509
    
  23
Have you worked out what 25 is? You go to Unicode and search for "basic Latin" and open that and look for 19 (hex for 25). And you find EM which is end-of-medium.
You may be able to parse the chars in Java and get it to print 19, which is also (I think ctrl-Y).

That is as far as I know, but try googling for end-of-medium and see whether you get anything useful (as opposed to 9435983759 sites about ouija boards ).
Ben George
Greenhorn

Joined: Nov 26, 2004
Posts: 3

The cause for my confusion is why are we getting the asterisk converted to the EM character? Is this something to do with the table data type of Oracle being wrapped in the WebSphere Connection object and then unwrapped for the data? Because I cannot see anywhere else in the flow where this gets converted.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38509
    
  23
Don't know . . .

Anybody else?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

We are using WSJdbcUtil.getNativeConnection method to get the array back from the stored procedure.
Something is not doing its job right, somewhere in there. I would start by looking at the stored procedure and at that WSJdbcUtil class.

I've seen other posts in the past asking how to get rid of control characters from XML coming from a database, but I don't remember if the problem was Oracle-specific or not.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Control character when retrieving a field from an Oracle Array