jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases and the fly likes Postgres JDBC encoding... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Postgres JDBC encoding..." Watch "Postgres JDBC encoding..." New topic

Postgres JDBC encoding...

Max Fildner

Joined: May 19, 2012
Posts: 1
Hello! Can somebody help me to resolve the following issue? Thanks.

I have the text file. Its encoding is ISO-8859-1. How did I know this? I opened the file in my Firefox and looked at the menu Web developer-> Character Encoding.
In Firefox I see the following string in the file: "aaaébbb".
I read this file in Java program using the following code:

When I print strLine in my Eclipse console I see this string: "aaaГ©bbb". Eclipse console is configured to show in Cp1251 encoding.
I have Postgres 9.0 database and the same string in it. When I select it via pgAdmin I see the same as in Eclipse console.
Now I need to read this string from file and to select from DB via JDBC using this string in WHERE clause.
But my select returns zero result.
When I change my sql from "WHERE field='"+strLine+"'" to "WHERE field LIKE 'aaa__bbb'" result is fine.

How can I use my string from file for correct select via JDBC? Thanks for any help.
I agree. Here's the link: http://aspose.com/file-tools
subject: Postgres JDBC encoding...
It's not a secret anymore!