• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Default encoding used while saving a varchar2(char) to a varchar2(byte) field.

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Here is the situation.

1) We are using oracle DB. we have a field in one of the table and that is having the type varchar2(500 bytes). please note that it is 500 bytes not characters.

2) From my java code I am using pstmt.setString() to set a value in this field.


- I want to know encoding will be used here to change characters to bytes -- the one configured in DB, Or the one which is default for the JVM. Or if there exists any default encoding setting at jdbc driver level.

- Also please let me know how to figure out default encoding used in this case. Any code snippet which will get me the encoding being used here?


Thanks in advance!
Pushker Chaubey
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The data will be stored using database character set. You can display this (and other national specific settings) with the following:

Look for the NLS_CHARACTERSET parameter. You should not need any specific privileges.

If you don't know what the database character set is, you may consider the NVARCHAR2 datatype. NVARCHAR2 is independent on the database character set.
 
Pushker Chaubey
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for your response sir!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic