wood burning stoves 2.0*
The moose likes JDBC and the fly likes Strange behaviour when accessing Oracle 8i table from servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Strange behaviour when accessing Oracle 8i table from servlet" Watch "Strange behaviour when accessing Oracle 8i table from servlet" New topic
Author

Strange behaviour when accessing Oracle 8i table from servlet

Pol Williams
Greenhorn

Joined: Mar 11, 2009
Posts: 3
Hi there,

First a little background, I'm using jdk 1.6. I've got a 2 column table in an Oracle 8i DB that holds a very simple code to word map. There are no strange characters. Both columns are varchar.

From my desktop machine, when I execute the the following:


Everything works fine, and I get the results I expect (both return values for getString(1) and getString(2) are exactly as they are stored in the table)

HOWEVER:

When I execute the same exact code in a servlet sitting on a Tomcat server (I'm using a simple applet servlet model to access the table and return a response to the applet), crs.getString(int) returns strings like: 0x53, 0x54, 0x4E and so on.

I am unsure what this means, and would be grateful for any assistance. I am wondering where to start to troubleshoot the problem.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Looks like the characters getting displayed as hexadecimal numbers, Where you get the hexadecimals, on a console (when you print them using, Sysout) OR on a Applet ?


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Pol Williams
Greenhorn

Joined: Mar 11, 2009
Posts: 3
Sagar Rohankar wrote:Looks like the characters getting displayed as hexadecimal numbers, Where you get the hexadecimals, on a console (when you print them using, Sysout) OR on a Applet ?


Thanks for the reply, this output happens when I send it to the applet, or when I log the output from the servlet to a log file. Any ideas why?
ken zhu
Greenhorn

Joined: Apr 09, 2009
Posts: 20
did you try to remove below code:


OR

just output to jsp page to check the strange issue.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Pol Williams wrote:this output happens when I send it to the applet, or when I log the output from the servlet to a log file. Any ideas why?

A silly guess, It may be possible that the values coming from the database are inserted/converted as hexadecimals. Look at the rows data.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Strange behaviour when accessing Oracle 8i table from servlet
 
Similar Threads
calling a procedure with an Oracle package
Nested Record sets and Joins
Connection pooling issue in Apache 6.0
Deployed App not connecting to Database
cachedrowset acceptchanges() NOT working