wood burning stoves 2.0*
The moose likes JDBC and the fly likes Storing Hypen in database from java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Storing Hypen in database from java" Watch "Storing Hypen in database from java" New topic
Author

Storing Hypen in database from java

Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
I am having a String which contains a hypen. I am using JDBC to connect to Oracle 10g database. When the string content is stored in the database hypen gets converted to inverted question mark.

Any suggestion on how to retain the hypen in database is greatly appreciated.

[ September 23, 2008: Message edited by: Vishnu Prakash ]
[ September 23, 2008: Message edited by: Vishnu Prakash ]

Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Srikanth Basa
Ranch Hand

Joined: Jun 06, 2005
Posts: 241
Can you post the code you are using ?
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2504
    
    8

When the string content is stored in the database hypen gets converted to inverted question mark.
Where - and how - do you see that it is stored in the database as a question mark?

quote
When data character set conversion is required, the target character set should be a superset of the source datafile character set. Otherwise, characters that have no equivalent in the target character set are converted to replacement characters, often a default character such as a question mark (?). This causes loss of data.

Data Conversion in JDBC


OCUP UML fundamental and ITIL foundation
youtube channel
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Storing Hypen in database from java