Win a copy of Rust Web Development this week in the Other Languages 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Character Encoding with DBCP pool

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm migrating a servlet/JSP application from ISO-8859-1 to UTF-8.
I use Mysql 5.0.45 which is UTF-8 configured and Tomcat 5.5.12.
I manage to read UTF-8 characters from database and display them in HTML page.
Submitting form data with UTF-8 character is also successful.
The problem is when i execute an update query, UTF-8 characters in SQL request are damaged. Problem occurs in JVM around DBCP and jdbc driver, not in database.

I tested direct use of driver with DriverManager like this :
Connection co = DriverManager.getConnection(...,...,...);
co.createStatement().executeUpdate(query);
and it's ok, UTF-8 characters are written correctly in database.

If i use connection from DBCP pool, character UTF-8 are considered as ISO 8859-1.

If a run Tomcat with -Dfile.encoding=UTF-8 JVM option, everything is ok ; but i can't use this work around because other applications use ISO 8859-1.

Someone has idea ? Thank's in advance
 
Olivier Debas
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When i use directly DBCP in my application to obtain connection, characters are well encoded in UTF-8.
When i use datasource which is set up in Tomcat, character are damaged with ISO 8859-1 encoding.
It seems that using Datasource is the cause of problems...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic