473,385 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

pg jdbc driver

Hey folks,

I'm currently evaluating an upgrade path from our current ColdFusion 5 /
PostgreSQL setup to ColdFusion MX / PostgreSQL. In the current setup,
we're using the Merant ODBC driver for postgres.

I've installed Fedora Core 2 with Apache 2 and ColdFusion MX, and I grabbed
the latest JDBC driver from the postgres website.

I copied one of our production websites over to the test box, but ran into
problems with display of non-standard english characters. This all
displays fine on our production servers running CF5 and the Merant ODBC
driver. We have several bilingual (french/english) websites, so this would
be a show stopper for us.

I created a JDBC datasource to the production database, so the only thing
that's changed is the driver (Merant ODBC -> PostgreSQL JDBC) and the
application server (ColdFusion 5 -> ColdFusion MX). I'm trying to narrow
down the culprit. Is there any chance that the JDBC driver could be the
problem here? Perhaps I'm missing something...

Cheers and thanks... Dino

_____________________________________
Rivendell Software - Dynamic Web Solutions
http://www.rivendellsoftware.com
Tel 902.461.1697
Fax 902.461.3765

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #1
5 2663


On Sat, 7 Aug 2004, Dino Nardini wrote:
[Could the JDBC driver be causing the problems I'm seeing with my
website after moving from ColdFusion with ODBC? ]


Unlikely. A common problem people find when using PostgreSQL's JDBC
driver is that they have setup their database with SQL_ASCII encoding
which doesn't have any information on what high-bit characters actually
represent. Many applications are OK with this and blindly pass data back
and forth, but Java requires having correctly encoded data and the JDBC
driver will error out with something like "Invalid character data was
found..." You reported problems correctly displaying this data, not an
error, so I doubt that is the issue.

As I mentioned Java is (sometimes painfully) encoding aware. I'm not
familar with ColdFusion, but you likely need to set the page encoding
correctly for converting Java Strings into bytes. This can be
accomplished in a number of ways, for example set globally via the
file.encoding system property or on per page basis via methods in
javax.servlet.ServletResponse such as setCharacterEncoding,
setContentType, and setLocale.

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #2


On Sun, 8 Aug 2004, Dino Nardini wrote:
However, when I tested the same data with ColdFusion MX (built on a Java
platform), I ran into problems. The french characters were either throwing
"Invalid character..." errors, or displaying as garbage. I'm guessing that
CFMX was trying to convert the characters from SQL_ASCII to something else
(UTF-8?) somewhere between the database and the web page.


The invalid character data errors are coming from the JDBC driver. When
it connects to the database it asks the server to send it data using UTF-8
regardless of the actual database encoding. The server cannot convert
SQL_ASCII to UTF-8 and simply returns the SQL_ASCII data. The JDBC driver
is expected UTF-8 data and chokes on this, so as you mentioned you will
need to dump and restore into a database with a "real" encoding. This
doesn't necessarily have to be unicode, but often makes the most sense.

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #3


On Mon, 9 Aug 2004, Dino Nardini wrote:
Hello there,

Is there no way to force the JDBC driver to simply pass the data as
SQL-ASCII, or ignore the encoding altogether?
No because Java itself needs it correctly encoded the JDBC driver needs to
make that happen.
I tried to dump and restore the database with UNICODE encoding but get
errors on restore because there is quotes/double quotes within some of the
text data. Is there an encoding that will handle both french language
characters and quotes/double quotes?


I've seen this problem with Microsoft "smart" quotes that are angled, but
there should be no problem with plain ' and ". When doing the dump /
restore you may need to actually convert the data from whatever encoding
you were using with something like iconv. If you are just struggling with
the quotes perhaps a simple search and replace would be fine.

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #4
Yes, I have the database encoding set to SQL_ASCII, which hasn't been a
problem with ColdFusion 5. As you say, the server has been blindly passing
the data back and forth.

However, when I tested the same data with ColdFusion MX (built on a Java
platform), I ran into problems. The french characters were either throwing
"Invalid character..." errors, or displaying as garbage. I'm guessing that
CFMX was trying to convert the characters from SQL_ASCII to something else
(UTF-8?) somewhere between the database and the web page.

I've managed to get CF5 installed on the new server for now, but I plan to
do some more testing with CFMX. Probably have to dump the database,
re-create with UNICODE encoding, and restore.

I suspected that the problem originated with encoding at the CFMX level,
but I wanted to cover all bases.

Thanks for the feedback.

Cheers... Dino

At 07:14 PM 08/08/2004 -0500, you wrote:

On Sat, 7 Aug 2004, Dino Nardini wrote:
[Could the JDBC driver be causing the problems I'm seeing with my
website after moving from ColdFusion with ODBC? ]


Unlikely. A common problem people find when using PostgreSQL's JDBC
driver is that they have setup their database with SQL_ASCII encoding
which doesn't have any information on what high-bit characters actually
represent. Many applications are OK with this and blindly pass data back
and forth, but Java requires having correctly encoded data and the JDBC
driver will error out with something like "Invalid character data was
found..." You reported problems correctly displaying this data, not an
error, so I doubt that is the issue.

As I mentioned Java is (sometimes painfully) encoding aware. I'm not
familar with ColdFusion, but you likely need to set the page encoding
correctly for converting Java Strings into bytes. This can be
accomplished in a number of ways, for example set globally via the
file.encoding system property or on per page basis via methods in
javax.servlet.ServletResponse such as setCharacterEncoding,
setContentType, and setLocale.

Kris Jurka


_____________________________________
Rivendell Software - Dynamic Web Solutions
http://www.rivendellsoftware.com
Tel 902.461.1697
Fax 902.461.3765

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #5
Hello there,

Is there no way to force the JDBC driver to simply pass the data as
SQL-ASCII, or ignore the encoding altogether?

I tried to dump and restore the database with UNICODE encoding but get
errors on restore because there is quotes/double quotes within some of the
text data. Is there an encoding that will handle both french language
characters and quotes/double quotes?

Cheers... Dino
At 08:23 PM 08/08/2004 -0500, Kris Jurka wrote:

On Sun, 8 Aug 2004, Dino Nardini wrote:
However, when I tested the same data with ColdFusion MX (built on a Java
platform), I ran into problems. The french characters were either

throwing
"Invalid character..." errors, or displaying as garbage. I'm guessing

that
CFMX was trying to convert the characters from SQL_ASCII to something else
(UTF-8?) somewhere between the database and the web page.


The invalid character data errors are coming from the JDBC driver. When
it connects to the database it asks the server to send it data using UTF-8
regardless of the actual database encoding. The server cannot convert
SQL_ASCII to UTF-8 and simply returns the SQL_ASCII data. The JDBC driver
is expected UTF-8 data and chokes on this, so as you mentioned you will
need to dump and restore into a database with a "real" encoding. This
doesn't necessarily have to be unicode, but often makes the most sense.

Kris Jurka


_____________________________________
Rivendell Software - Dynamic Web Solutions
http://www.rivendellsoftware.com
Tel 902.461.1697
Fax 902.461.3765

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: JShurmatz | last post by:
If anyone can shed some light on this problem I would greatly appreciate it. I am unsuccessfully trying to use a database connnection retrieved from a pool configured using Java System Web...
1
by: Axel Dachtler | last post by:
Hello, my Java-program can't load the JDBC driver. I always get a java.lang.NoClassDefFoundError when I run it. The JDBC Driver is in the directory: C:\programs\ora92\jdbc\lib I think I...
0
by: Nils Valentin | last post by:
Hi MySQL Fans ;-), Is it possible that the 3.08 series allows to connect to 4.0.14 versions but not to the 4.1 alpha-versions ? I get belows error when tryig to connect from DbVisualizer which...
3
by: Steverino | last post by:
Hi, I'm currently trying to learn DB2. I have the following version below installed on my server machine on my little LAN. However when I try to connect to it from my client machine, I receive...
4
by: Dani | last post by:
Hi everyone Description of the problem: Using a PreparedStatement to write down an integer (int) plus a timestamp for testing purposes. When read out again the integer looks very different. We...
0
by: Bing | last post by:
Hi, I am configuring the same DB2 v8.1 JDBC universal driver (db2jcc.jar and db2jcc_license_cisuz.jar) from DB2 SP5 fix pack under WSAD 5.1.x environment and WebSphere application Server 5.0.2...
2
by: Raquel | last post by:
Read this about the Universal JDBC Driver.... "In a Type 2 mode, the Universal JDBC driver provides local application performance gains (because it avoids using TCP/IP protocol to communicate to...
4
by: Izak van Langevelde | last post by:
Shocks. Today I came to learn that Suns jdbc-odbc bridge driver isn't meant for serious purposes; it's experimental. I already knew it isn't thread safe, but didn't think of this as problematic for...
3
by: Anoop | last post by:
Is it true that there are no type 4 jdbc drivers to connect to a DB2 server v7.1? The DB2 server is hosted on ACF2 (OS/390). We would be connecting from windows and solaris boxes. If it is true,...
0
by: Jim Kennedy | last post by:
ALL DDL does a commit. Hence Drop Table movies; issues a commit. True you don't issue a commit and the driver does not issue a commit, but the server does for all DDL. That is probably where...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.