Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Strange behaviour when accessing Oracle 8i table from servlet

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Pol Williams
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you try to remove below code:


OR

just output to jsp page to check the strange issue.
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
It runs on an internal combustion engine. This ad does not:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic