Results 1 to 5 of 5
  1. #1
    preethi.raj is offline Member
    Join Date
    Oct 2012
    Posts
    3
    Rep Power
    0

    Default Postgresql with JDBC - Client encoding issue

    Hi,


    In my project, we are using PostgreSQL jdbc driver for inserting data into db.
    The values may contain other languages like Chinese, Japanese, German expressions.

    Apart from inserting the English expression, am getting the following exceptions:

    2012-10-11 02:41:37,589 [HttpClient-15] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 22P05
    2012-10-11 02:41:37,589 [HttpClient-15] ERROR org.hibernate.util.JDBCExceptionReporter - Batch entry 4 insert into summary (value, id, property) values ('Microsoft Windows 7 ??? ', '7', 'Name') was aborted. Call getNextException to see the cause.
    2012-10-11 02:41:37,589 [HttpClient-15] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 22P05
    2012-10-11 02:41:37,589 [HttpClient-15] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: character 0xe69797 of encoding "UTF8" has no equivalent in "WIN1252"


    Please provide any suggestions

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,040
    Rep Power
    20

    Default Re: Postgresql with JDBC - Client encoding issue

    Don't use WIN1252 character encoding on your database?
    At least if I've interpreted that log output correctly.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    preethi.raj is offline Member
    Join Date
    Oct 2012
    Posts
    3
    Rep Power
    0

    Default Re: Postgresql with JDBC - Client encoding issue

    Quote Originally Posted by Tolls View Post
    Don't use WIN1252 character encoding on your database?
    At least if I've interpreted that log output correctly.
    Thank you for your reply.
    If i use the same insert query in PgAdmin tool , values are successfully inserted.
    Through PostgreSQL JDBC driver only we are facing problems.

    It seems the client_encode will be always set to Unicode in jdbc while start up.
    Ref :
    How to insert Chinese (big5) through JDBC? - Grokbase

    After converting the Chinese string to Unicode in our program, we can able to insert through jdbc.
    Is this the only option? Can we set the client_encode according to our need in jdbc?

    Regards,
    Preethi.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,040
    Rep Power
    20

    Default Re: Postgresql with JDBC - Client encoding issue

    With characters you need to ensure you are using the same character set throughout.
    Well, either that or attempt to convert them which is not much fun.

    The PgAdmin tool will be using whatever character set the db is set up for, so it's no great surprise that that works.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    preethi.raj is offline Member
    Join Date
    Oct 2012
    Posts
    3
    Rep Power
    0

    Default Re: Postgresql with JDBC - Client encoding issue

    Thanks for your solution.
    After i changed the database encoding type to UTF8, we can able to insert any language string to database through JDBC.

Similar Threads

  1. Encoding issue
    By kerimabdullah in forum New To Java
    Replies: 1
    Last Post: 03-08-2012, 07:03 PM
  2. Replies: 3
    Last Post: 12-12-2010, 08:25 PM
  3. help with jdbc for postgresql
    By arano86 in forum New To Java
    Replies: 2
    Last Post: 09-14-2009, 12:27 PM
  4. encoding issue in jsp
    By sams11 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 11-25-2008, 07:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •