Thread: JDBC and Unicode problem

JDBC and Unicode problem

From
Zeljko Trogrlic
Date:
Hello,

I'm trying to store / retrieve data from UNICODE database, but without success.

I installet PostgreSQL 7.02 binaries for RedHat Linux on RH 6.2
I created database with UNICODE as charset (createdb -E UNICODE name)
I can establish JDBC connection and everything works fine when I use ASCII
characters.
When I use non-ASCII characters, I get all kind of stuff.

I tried to store data using* setString* setObject* setBytes* setUnicodeStream

without success.

My questions are:* Are binaries configured for UNICODE support?* How can I check are binaries configured for UNICODE
support?*Do I have to set somethinh in Java in order to get UNICODE working?* Which method should I use to read UNICODE
data?

I have to enter multilingual data so I can't switch to national character set. 


Re: JDBC and Unicode problem

From
Zeljko Trogrlic
Date:
After browsing through hundreds of messages, downloading source etc. I
finally found how to use UNICODE from JDBC. This is problem because of bug
in driver which I'll explain later. I'll post that here to help other with
the same problem:

Check that PostgreSQL supports UNICODE with SELECT getdatabaseencoding();
Check that database is created for UNICODE: open psql and type \l[ENTER]
Maybe you should do just one of above; I'm not sure.
Check that you have correct code page during compiling Java source, or your
String constants will be wrong. In JBuilder 3.0:  Project -> Properties ->
Compiler -> Encoding

And  now solution for JDBC problems:
Add to Java parameters -Dfile.encoding=UTF-8

Everything should work now, but mind that all methods that use default
encoding (file readers/writers, string.toBytes()) will use UTF-8 so you
have to explicitly say which encoding you use.

This is because of bug in driver; in connection.ExecSQL there is line 
buf = sql.getBytes();
This line uses platform default encoding. If you use Cp1250, sql statement
will be encoded for that code page, or whatever code page you use, BUT IT
SHOULD BE ENCODED FOR DATABASE'S CODE PAGE!

The best solution will be if Connection reads which encoding PostgreSQL
expects and to replace line with:
buf = sql.getBytes(javaEncodingName);
(PostgreSQL's UNICODE must be converted to standard UTF-8)

Less perfect, but also acceptable solution will be to inform driver somehow
which encoding to use.

One of the options will be to use "SET client_encoding", but PostgreSQL
don't have support for Unicode-to-something-else support.

Solution is based on Tatsuo Ishii's postings.


RE: JDBC and Unicode problem

From
Peter Mount
Date:
It isn't a bug as such as I've never implemented unicode.

However, your solution looks like a good one, but I'm not sure how you would
pass that parameter to either an applet or a servlet.

There's a lot of factors here, which cause JDBC to suffer. Because of the
sheer amount of email I see (about 200 a day each at work and at home), I
tend to read only emails that say "JDBC" in the subject line. However, this
means that a lot of the time I miss out on emails saying that something has
changed (eg: getTimestamp() fails due to the format changing slightly
between versions), and I know there's a lot of functionality in 7.0 that
would improve things but I haven't seen enough examples to actually
implement them...

Peter

-- 
Peter Mount
Enterprise Support Officer, Maidstone Borough Council
Email: petermount@maidstone.gov.uk
WWW: http://www.maidstone.gov.uk
All views expressed within this email are not the views of Maidstone Borough
Council


-----Original Message-----
From: Zeljko Trogrlic [mailto:zeljko@technologist.com]
Sent: Tuesday, September 05, 2000 7:47 PM
To: pgsql-interfaces@postgresql.org
Cc: Peter Mount
Subject: Re: [INTERFACES] JDBC and Unicode problem


After browsing through hundreds of messages, downloading source etc. I
finally found how to use UNICODE from JDBC. This is problem because of bug
in driver which I'll explain later. I'll post that here to help other with
the same problem:

Check that PostgreSQL supports UNICODE with SELECT getdatabaseencoding();
Check that database is created for UNICODE: open psql and type \l[ENTER]
Maybe you should do just one of above; I'm not sure.
Check that you have correct code page during compiling Java source, or your
String constants will be wrong. In JBuilder 3.0:  Project -> Properties ->
Compiler -> Encoding

And  now solution for JDBC problems:
Add to Java parameters -Dfile.encoding=UTF-8

Everything should work now, but mind that all methods that use default
encoding (file readers/writers, string.toBytes()) will use UTF-8 so you
have to explicitly say which encoding you use.

This is because of bug in driver; in connection.ExecSQL there is line 
buf = sql.getBytes();
This line uses platform default encoding. If you use Cp1250, sql statement
will be encoded for that code page, or whatever code page you use, BUT IT
SHOULD BE ENCODED FOR DATABASE'S CODE PAGE!

The best solution will be if Connection reads which encoding PostgreSQL
expects and to replace line with:
buf = sql.getBytes(javaEncodingName);
(PostgreSQL's UNICODE must be converted to standard UTF-8)

Less perfect, but also acceptable solution will be to inform driver somehow
which encoding to use.

One of the options will be to use "SET client_encoding", but PostgreSQL
don't have support for Unicode-to-something-else support.

Solution is based on Tatsuo Ishii's postings.


RE: JDBC and Unicode problem

From
Zeljko Trogrlic
Date:
Which parameter? Servlet or applet don't have to know anything about encoding.

But if you want to pass parameter from servlet/applet to driver, connection
properties would be a good place. Interbase use such approach. Interbase
example:

properties.put("user", "SYSDBA");
properties.put("password", "masterkey");
properties.put("charSet", "UTF8");
DriverManager.getConnection("jdbc:interbase://192.168.0.200/root/AIR.GDB",
properties);

At 10:01 6.9.2000 , Peter Mount wrote:
>It isn't a bug as such as I've never implemented unicode.
>
>However, your solution looks like a good one, but I'm not sure how you would
>pass that parameter to either an applet or a servlet.
>
>There's a lot of factors here, which cause JDBC to suffer. Because of the
>sheer amount of email I see (about 200 a day each at work and at home), I
>tend to read only emails that say "JDBC" in the subject line. However, this
>means that a lot of the time I miss out on emails saying that something has
>changed (eg: getTimestamp() fails due to the format changing slightly
>between versions), and I know there's a lot of functionality in 7.0 that
>would improve things but I haven't seen enough examples to actually
>implement them...
>
>Peter


RE: JDBC and Unicode problem

From
Zeljko Trogrlic
Date:
Solution for automatic encoding detection:
* Make a Hashmap that maps PostgreSQL encoding names to Java encoding names
(UNICODE = UTF-8)
* When getConnection is called, execute select getdatabaseencoding(). This
will return encoding name.
* Get Java encoding name and store it into connection specific variable.
* When executing SQL-s or reading data, use that encoding as parameter.

In getString, replace:return new String(this_row[columnIndex - 1]);
withreturn new String(this_row[columnIndex - 1], encoding);

And JDBC will work for all encodings entered into mapping Hashmap. If I
only had write CVS access... ;)

At 10:01 6.9.2000 , Peter Mount wrote:
>It isn't a bug as such as I've never implemented unicode.
>
>However, your solution looks like a good one, but I'm not sure how you would
>pass that parameter to either an applet or a servlet.



Re: JDBC and Unicode problem

From
Zeljko Trogrlic
Date:
The problem continues...

We are using Webmacro for dynamic web pages. Unfortunately, there is no way
to tell Webmacro which encoding to use to load templates. So you have to
pieces of software with "fixed" encoding. If you need different ones for
each piece, it won't work.

I know that Webmacro team is working on solution of this problem, but it
will be better to fix this on both places, in case there is some other Java
library with such problem.

At 20:47 5.9.2000 , you wrote:
>After browsing through hundreds of messages, downloading source etc. I
>finally found how to use UNICODE from JDBC. This is problem because of bug
>in driver which I'll explain later. I'll post that here to help other with
>the same problem:


RE: JDBC and Unicode problem

From
Peter Mount
Date:
I was thinking of parameter's to the JVM on startup (like
-Djdbc.driver=org.postgresql.Driver )

As for connection properties, yes they are an ideal place, and back in the
6.3 days we used to use them so the mechanism is in there. I think the
connection properties is the way to go, as it would then work everywhere.

Peter

-- 
Peter Mount
Enterprise Support Officer, Maidstone Borough Council
Email: petermount@maidstone.gov.uk
WWW: http://www.maidstone.gov.uk
All views expressed within this email are not the views of Maidstone Borough
Council


-----Original Message-----
From: Zeljko Trogrlic [mailto:zeljko@technologist.com]
Sent: Wednesday, September 06, 2000 12:31 PM
To: pgsql-interfaces@postgresql.org
Cc: Peter Mount (Home)
Subject: RE: [INTERFACES] JDBC and Unicode problem


Which parameter? Servlet or applet don't have to know anything about
encoding.

But if you want to pass parameter from servlet/applet to driver, connection
properties would be a good place. Interbase use such approach. Interbase
example:

properties.put("user", "SYSDBA");
properties.put("password", "masterkey");
properties.put("charSet", "UTF8");
DriverManager.getConnection("jdbc:interbase://192.168.0.200/root/AIR.GDB",
properties);

At 10:01 6.9.2000 , Peter Mount wrote:
>It isn't a bug as such as I've never implemented unicode.
>
>However, your solution looks like a good one, but I'm not sure how you
would
>pass that parameter to either an applet or a servlet.
>
>There's a lot of factors here, which cause JDBC to suffer. Because of the
>sheer amount of email I see (about 200 a day each at work and at home), I
>tend to read only emails that say "JDBC" in the subject line. However, this
>means that a lot of the time I miss out on emails saying that something has
>changed (eg: getTimestamp() fails due to the format changing slightly
>between versions), and I know there's a lot of functionality in 7.0 that
>would improve things but I haven't seen enough examples to actually
>implement them...
>
>Peter


RE: JDBC and Unicode problem

From
Tatsuo Ishii
Date:
MOTOKI Sinichi, a subscriver of our PostgreSQL local mailing list, has
made a patch for 7.0.2 JDBC driver. With the patch and MB enabled
installation (configure --enable-multibyte=UNICODE), you could use
UTF-8 acording to him. You will need to create db with -E UNICODE if
you did just --enable-multibyte (witout =UNICODE), or you choose other
encodings.
--
Tatsuo Ishii

> I was thinking of parameter's to the JVM on startup (like
> -Djdbc.driver=org.postgresql.Driver )
> 
> As for connection properties, yes they are an ideal place, and back in the
> 6.3 days we used to use them so the mechanism is in there. I think the
> connection properties is the way to go, as it would then work everywhere.
> 
> Peter

begin 644 postgresql-jdbc-7.0.2-ce.diff.gz
M'XL("*5KI3D"`W!O<W1G<F5S<6PM:F1B8RTW+C`N,BUC92YD:69F`.T=^W/:
M1O-G_%=<W&]JB(5`XHV;3AWLIJ2I[0;2SC?],AY9'$:-D(@>MFGJ__W;>TDG
M(0GP(X\VC,<&W=[>WC[N=O?V\#=H/+-\!#\&6AB!.4-3UT,+UP\N/>R_MZM_
M3B[,:D>MJSH*7!0N)D:`D160#YE051/O?(/@9^PB8[&PER@@`U#<?7@\&A^?
M(:V/!K.)Y1$LP0PCWPT]$R-X@LW`]9:J`-3[Z'7H4)@]BHWBV4,+S[WTC#FZ
MMH*9-`":6C9&!LS'680!8`$\PRE:NB&:N,AQ`S0SKI*H%#(9VM\+D#ME0\V-
M=UB,9)COC$LRIV!F!!25:3AHBNEPGCNG/0;N?.'A&79\"_"?8<]&AYXY(Q].
M<'#M>N_(W&=!L.C7:M?7U^H"0%33G=<&9X<G-2,,9J[GUUZZ,\,Y_PVP&HY?
MBZBHWJA+-3`\]?(O,B'&#^/"!>QO7K]2T-[-'O)G;FA/T`5&.@()SJS+&?88
M!S(D01GGA@'%%/J8S%SFRE:2XARFK#70!)O8"=!S`'1P-5@NH-,,VW8_0Z:T
M01)B6GRQ\)P]+CL_!.H-UE.AC7-CB1R,)X1$X%MHV#!5T\.@J%1JF*+U"5Y@
MTK4#/++=ZTC%&I**Y6I7AEZ-9QCX9GB8=@51PM@3GU+":&$DU";8Q@&GH2;X
M9F$?^+$3N&0V>ZYW68N-J:::5[YUZ;@>WMLQ9W-W@NKM9K,0+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P`G,QA=:V-%C]H+CA_%L>D,LGR,I5(#"9W
MACDSM6W.-C<D*B+@,DE85I82)PU_@_Q[FM>;>H1B,CE[[=KYB'WX+#5^T0ZS
MNG7@.2M23_!%[!M3UZ,W&2QZT0#^?`?P_'R(?-Q_AO2*M"?@^1_66V$;*^,S
M,Q%\!E"TC[2W8JQ$T=5'87S@A;A&KSL6\%I<CK3\+Y//9)(I%O,;GE\K-A[X
M]"CI"7%19>A-?+N?^TR"COCB5'Z?`^%EX6B\:/<!DLG]V,**G4J\GT7]XOK!
MHFFG:(AV,_*&;H\4WR8T)/#<?JT-^9?5AH#R%I<6)30[NW(XLYI$82K(OVZC
M>(S"T]N'*%GY6A=QW[J(.^M)NI+BCII06)!Q_Z/JO.\V+CRGSOE6S/Q#ZNP.
M=SFASL%T]WKIEO;O.9UF"5F&;(61VQU0?]T0'W(9DS/EVVZ+I:\5DU^(R.XA
MD!6)?'4`9#%\-N61M\DO\8^_L%_Z&O]#\@\S\K[+_QMT1)Z)O#9_]9&FUED;
M^?Y3!WL&$1UO2]5F=?MZAVU^WZ`7$>S%,D86_8L0I*L4[#5)`/KQMTQ;L)#V
MT7^Q#VT+M!?_!P%-TSMUU&MWM*:NMYJHKM7)_TT`,+/H/TT@UJ?1T+MMJ<]B
MI<_*5S#KC6ZGQSIW]':SL'/ZVWAZS:Y.NVH=K=TJ[)IQ4;_9[;5Y;UW3"GMG
MWZS6FPV]+L9O===B6+THVFCWNKT(0Z^0VWFWW03K.WJWNQY!?N4BBL3>UM;C
MR7$KLXF1+"9M&Y+9)&SJG16@/]B_2IGD&\!;;E.D^V"&S7=^..^C+KA\>KO3
1ZZ)V&P1+0?X/KKV`VM%H````
`
end


RE: JDBC and Unicode problem

From
Zeljko Trogrlic
Date:
Thanks. I checked code and the idea seems fine. I hope it will fine the way
to regular JDBC driver soon. It similar to idea I sent few days ago - all
great minds thinks similar :)

BTW is there anonymous CVS account on PostgreSQL repository?

At 09:13 11.9.2000 , Tatsuo Ishii wrote:
>MOTOKI Sinichi, a subscriver of our PostgreSQL local mailing list, has
>made a patch for 7.0.2 JDBC driver. With the patch and MB enabled
>installation (configure --enable-multibyte=UNICODE), you could use
>UTF-8 acording to him. You will need to create db with -E UNICODE if
>you did just --enable-multibyte (witout =UNICODE), or you choose other
>encodings.
>--
>Tatsuo Ishii
>
>> I was thinking of parameter's to the JVM on startup (like
>> -Djdbc.driver=org.postgresql.Driver )
>> 
>> As for connection properties, yes they are an ideal place, and back in the
>> 6.3 days we used to use them so the mechanism is in there. I think the
>> connection properties is the way to go, as it would then work everywhere.
>> 
>> Peter
>
>




RE: JDBC and Unicode problem

From
"Mike Cannon-Brookes"
Date:
Guys,

Did these changes get worked into the latest driver src?

I looked at the changes file at
http://www.retep.org.uk/postgres/changelog.html but the only possible change
I see after the date of this email is:
- Merged in some last patches. Only 1 left, which may not be compatible with
jdbc1

I'm trying to convert a current site from HSQL (eugh!) to PostgreSQL but I
can't get the Unicode working as per this email thread - I've tried the
usual compile with Unicode, createdb with unicode encoding etc.


Many thanks,
Mike


>Thanks. I checked code and the idea seems fine. I hope it will fine the way
>to regular JDBC driver soon. It similar to idea I sent few days ago - all
>great minds thinks similar :)

>BTW is there anonymous CVS account on PostgreSQL repository?

>At 09:13 11.9.2000 , Tatsuo Ishii wrote:
>>MOTOKI Sinichi, a subscriver of our PostgreSQL local mailing list, has
>>made a patch for 7.0.2 JDBC driver. With the patch and MB enabled
>>installation (configure --enable-multibyte=UNICODE), you could use
>>UTF-8 acording to him. You will need to create db with -E UNICODE if
>>you did just --enable-multibyte (witout =UNICODE), or you choose other
>>encodings.
>>--
>>Tatsuo Ishii
>>
>>> I was thinking of parameter's to the JVM on startup (like
>>> -Djdbc.driver=org.postgresql.Driver )
>>>
>>> As for connection properties, yes they are an ideal place, and back in
the
>>> 6.3 days we used to use them so the mechanism is in there. I think the
>>> connection properties is the way to go, as it would then work
everywhere.
>>>
>>> Peter
>>
>>



RE: RE: JDBC and Unicode problem

From
Peter Mount
Date:
The current sources in cvs should work with unicode. One of the other
patches that did get in dealt with making the driver handle string encodings
correctly.

If you still have problems let me know.

PS: The patch I've not applied yet deals with handling Arrays (part of the
JDBC2 spec), however I'm not sure how that patch works fully, and as it
patches org.postgresql.Connection it could affect how jdbc1 works, hence
that comment in changelog.

Peter

-- 
Peter Mount
Enterprise Support Officer, Maidstone Borough Council
Email: petermount@maidstone.gov.uk
WWW: http://www.maidstone.gov.uk
All views expressed within this email are not the views of Maidstone Borough
Council


-----Original Message-----
From: Mike Cannon-Brookes [mailto:mcannon@internet.com]
Sent: Tuesday, November 14, 2000 12:43 PM
To: pgsql-interfaces@postgresql.org
Subject: [INTERFACES] RE: JDBC and Unicode problem 


Guys,

Did these changes get worked into the latest driver src?

I looked at the changes file at
http://www.retep.org.uk/postgres/changelog.html but the only possible change
I see after the date of this email is:
- Merged in some last patches. Only 1 left, which may not be compatible with
jdbc1

I'm trying to convert a current site from HSQL (eugh!) to PostgreSQL but I
can't get the Unicode working as per this email thread - I've tried the
usual compile with Unicode, createdb with unicode encoding etc.


Many thanks,
Mike


>Thanks. I checked code and the idea seems fine. I hope it will fine the way
>to regular JDBC driver soon. It similar to idea I sent few days ago - all
>great minds thinks similar :)

>BTW is there anonymous CVS account on PostgreSQL repository?

>At 09:13 11.9.2000 , Tatsuo Ishii wrote:
>>MOTOKI Sinichi, a subscriver of our PostgreSQL local mailing list, has
>>made a patch for 7.0.2 JDBC driver. With the patch and MB enabled
>>installation (configure --enable-multibyte=UNICODE), you could use
>>UTF-8 acording to him. You will need to create db with -E UNICODE if
>>you did just --enable-multibyte (witout =UNICODE), or you choose other
>>encodings.
>>--
>>Tatsuo Ishii
>>
>>> I was thinking of parameter's to the JVM on startup (like
>>> -Djdbc.driver=org.postgresql.Driver )
>>>
>>> As for connection properties, yes they are an ideal place, and back in
the
>>> 6.3 days we used to use them so the mechanism is in there. I think the
>>> connection properties is the way to go, as it would then work
everywhere.
>>>
>>> Peter
>>
>>


RE: RE: JDBC and Unicode problem

From
"Mike Cannon-Brookes"
Date:
I'm using a driver built from the 7.0.3 source downloaded as of 24 hours
ago.

I still get ???'s in the database when using a UNICODE encoded DB and having
compiled the server with --enable-multibyte=UNICODE .

What's the best way to test whether the problem is in the driver?

Can anyone think of another place to look for problems? (Bearing in mind
this setup works fine with HSQL which uses Unicode natively)

This is using EJBs so JDBC 2 is required, could it be the arrays problem?

Thanks for any assistance - deadlines are rushing up fast ;)

Mike

> -----Original Message-----
> From: pgsql-interfaces-owner@postgresql.org
> [mailto:pgsql-interfaces-owner@postgresql.org]On Behalf Of Peter Mount
> Sent: Wednesday, November 15, 2000 12:00 AM
> To: 'Mike Cannon-Brookes'; pgsql-interfaces@postgresql.org
> Subject: RE: [INTERFACES] RE: JDBC and Unicode problem
>
>
> The current sources in cvs should work with unicode. One of the other
> patches that did get in dealt with making the driver handle
> string encodings
> correctly.
>
> If you still have problems let me know.
>
> PS: The patch I've not applied yet deals with handling Arrays (part of the
> JDBC2 spec), however I'm not sure how that patch works fully, and as it
> patches org.postgresql.Connection it could affect how jdbc1 works, hence
> that comment in changelog.
>
> Peter
>
> --
> Peter Mount
> Enterprise Support Officer, Maidstone Borough Council
> Email: petermount@maidstone.gov.uk
> WWW: http://www.maidstone.gov.uk
> All views expressed within this email are not the views of
> Maidstone Borough
> Council
>
>
> -----Original Message-----
> From: Mike Cannon-Brookes [mailto:mcannon@internet.com]
> Sent: Tuesday, November 14, 2000 12:43 PM
> To: pgsql-interfaces@postgresql.org
> Subject: [INTERFACES] RE: JDBC and Unicode problem
>
>
> Guys,
>
> Did these changes get worked into the latest driver src?
>
> I looked at the changes file at
> http://www.retep.org.uk/postgres/changelog.html but the only
> possible change
> I see after the date of this email is:
> - Merged in some last patches. Only 1 left, which may not be
> compatible with
> jdbc1
>
> I'm trying to convert a current site from HSQL (eugh!) to PostgreSQL but I
> can't get the Unicode working as per this email thread - I've tried the
> usual compile with Unicode, createdb with unicode encoding etc.
>
>
> Many thanks,
> Mike
>
>
> >Thanks. I checked code and the idea seems fine. I hope it will
> fine the way
> >to regular JDBC driver soon. It similar to idea I sent few days ago - all
> >great minds thinks similar :)
>
> >BTW is there anonymous CVS account on PostgreSQL repository?
>
> >At 09:13 11.9.2000 , Tatsuo Ishii wrote:
> >>MOTOKI Sinichi, a subscriver of our PostgreSQL local mailing list, has
> >>made a patch for 7.0.2 JDBC driver. With the patch and MB enabled
> >>installation (configure --enable-multibyte=UNICODE), you could use
> >>UTF-8 acording to him. You will need to create db with -E UNICODE if
> >>you did just --enable-multibyte (witout =UNICODE), or you choose other
> >>encodings.
> >>--
> >>Tatsuo Ishii
> >>
> >>> I was thinking of parameter's to the JVM on startup (like
> >>> -Djdbc.driver=org.postgresql.Driver )
> >>>
> >>> As for connection properties, yes they are an ideal place, and back in
> the
> >>> 6.3 days we used to use them so the mechanism is in there. I think the
> >>> connection properties is the way to go, as it would then work
> everywhere.
> >>>
> >>> Peter
> >>
> >>
>



RE: RE: JDBC and Unicode problem

From
Peter Mount
Date:
See below:

-- 
Peter Mount
Enterprise Support Officer, Maidstone Borough Council
Email: petermount@maidstone.gov.uk
WWW: http://www.maidstone.gov.uk
All views expressed within this email are not the views of Maidstone Borough
Council


-----Original Message-----
From: Mike Cannon-Brookes [mailto:mcannon@internet.com]
Sent: Wednesday, November 15, 2000 6:56 AM
To: Peter Mount; pgsql-interfaces@postgresql.org
Subject: RE: [INTERFACES] RE: JDBC and Unicode problem 


I'm using a driver built from the 7.0.3 source downloaded as of 24 hours
ago.

I still get ???'s in the database when using a UNICODE encoded DB and having
compiled the server with --enable-multibyte=UNICODE .

What's the best way to test whether the problem is in the driver?

PM: If I get chance I'll try to build a backend with multibyte enabled.

Can anyone think of another place to look for problems? (Bearing in mind
this setup works fine with HSQL which uses Unicode natively)

This is using EJBs so JDBC 2 is required, could it be the arrays problem?

PM: No, as you would be getting "not implemented" exceptions...

Thanks for any assistance - deadlines are rushing up fast ;)

Mike

> -----Original Message-----
> From: pgsql-interfaces-owner@postgresql.org
> [mailto:pgsql-interfaces-owner@postgresql.org]On Behalf Of Peter Mount
> Sent: Wednesday, November 15, 2000 12:00 AM
> To: 'Mike Cannon-Brookes'; pgsql-interfaces@postgresql.org
> Subject: RE: [INTERFACES] RE: JDBC and Unicode problem
>
>
> The current sources in cvs should work with unicode. One of the other
> patches that did get in dealt with making the driver handle
> string encodings
> correctly.
>
> If you still have problems let me know.
>
> PS: The patch I've not applied yet deals with handling Arrays (part of the
> JDBC2 spec), however I'm not sure how that patch works fully, and as it
> patches org.postgresql.Connection it could affect how jdbc1 works, hence
> that comment in changelog.
>
> Peter
>
> --
> Peter Mount
> Enterprise Support Officer, Maidstone Borough Council
> Email: petermount@maidstone.gov.uk
> WWW: http://www.maidstone.gov.uk
> All views expressed within this email are not the views of
> Maidstone Borough
> Council
>
>
> -----Original Message-----
> From: Mike Cannon-Brookes [mailto:mcannon@internet.com]
> Sent: Tuesday, November 14, 2000 12:43 PM
> To: pgsql-interfaces@postgresql.org
> Subject: [INTERFACES] RE: JDBC and Unicode problem
>
>
> Guys,
>
> Did these changes get worked into the latest driver src?
>
> I looked at the changes file at
> http://www.retep.org.uk/postgres/changelog.html but the only
> possible change
> I see after the date of this email is:
> - Merged in some last patches. Only 1 left, which may not be
> compatible with
> jdbc1
>
> I'm trying to convert a current site from HSQL (eugh!) to PostgreSQL but I
> can't get the Unicode working as per this email thread - I've tried the
> usual compile with Unicode, createdb with unicode encoding etc.
>
>
> Many thanks,
> Mike
>
>
> >Thanks. I checked code and the idea seems fine. I hope it will
> fine the way
> >to regular JDBC driver soon. It similar to idea I sent few days ago - all
> >great minds thinks similar :)
>
> >BTW is there anonymous CVS account on PostgreSQL repository?
>
> >At 09:13 11.9.2000 , Tatsuo Ishii wrote:
> >>MOTOKI Sinichi, a subscriver of our PostgreSQL local mailing list, has
> >>made a patch for 7.0.2 JDBC driver. With the patch and MB enabled
> >>installation (configure --enable-multibyte=UNICODE), you could use
> >>UTF-8 acording to him. You will need to create db with -E UNICODE if
> >>you did just --enable-multibyte (witout =UNICODE), or you choose other
> >>encodings.
> >>--
> >>Tatsuo Ishii
> >>
> >>> I was thinking of parameter's to the JVM on startup (like
> >>> -Djdbc.driver=org.postgresql.Driver )
> >>>
> >>> As for connection properties, yes they are an ideal place, and back in
> the
> >>> 6.3 days we used to use them so the mechanism is in there. I think the
> >>> connection properties is the way to go, as it would then work
> everywhere.
> >>>
> >>> Peter
> >>
> >>
>


ODBD and unixODBC

From
Friedrich Dominicus
Date:
Hello, some of you have wrote that they are using Postgres 7.02 with
unixODBC. I'm struggling with that. So my question do I have to
compile POSTGRES on my own, with the right switches or can I should I
be able to use the Driver which comes with unixODBC. 

I got my system running and can connect to POSTGRES with psql but if I
try it with isql than I got a connection error. So what information do
I have too add to make it "apparently" to you to understand?

Friedrich Dominicus


Re: ODBD and unixODBC

From
Max Khon
Date:
hi, there!

On 15 Nov 2000, Friedrich Dominicus wrote:

> Hello, some of you have wrote that they are using Postgres 7.02 with
> unixODBC. I'm struggling with that. So my question do I have to
> compile POSTGRES on my own, with the right switches or can I should I
> be able to use the Driver which comes with unixODBC. 

we use driver that comes with unixODBC
no compilation switches for postgres are required

> I got my system running and can connect to POSTGRES with psql but if I
> try it with isql than I got a connection error. So what information do
> I have too add to make it "apparently" to you to understand?

which error messages do you get?

/fjoe



Re: ODBD and unixODBC

From
Friedrich Dominicus
Date:
Max Khon <fjoe@iclub.nsu.ru> writes:

> 
> we use driver that comes with unixODBC
> no compilation switches for postgres are required
> 
> > I got my system running and can connect to POSTGRES with psql but if I
> > try it with isql than I got a connection error. So what information do
> > I have too add to make it "apparently" to you to understand?
> 
> which error messages do you get?
and obvious one I guess ;-)

./isql -v p_test frido
[unixODBC]Could not connect to the server;
Could not connect to remote socket.
[ISQL]ERROR: Could not SQLConnect

Regards
Friedrich


Re: ODBD and unixODBC

From
Max Khon
Date:
hi, there!

On 15 Nov 2000, Friedrich Dominicus wrote:

> > we use driver that comes with unixODBC
> > no compilation switches for postgres are required
> > 
> > > I got my system running and can connect to POSTGRES with psql but if I
> > > try it with isql than I got a connection error. So what information do
> > > I have too add to make it "apparently" to you to understand?
> > 
> > which error messages do you get?
> and obvious one I guess ;-)
> 
> ./isql -v p_test frido
> [unixODBC]Could not connect to the server;
> Could not connect to remote socket.
> [ISQL]ERROR: Could not SQLConnect

do you have enabled network connections in your pg_hba.conf

/fjoe



ODBC Maintainer?

From
"Robert Smith"
Date:
Hey, who is the current active maintainer of the ODBC driver?

Thanks!
Robert Smith



Re: ODBC Maintainer?

From
Kovacs Zoltan Sandor
Date:
> Hey, who is the current active maintainer of the ODBC driver?
Currently there is no maintainer, afaik.

Zoltan



Re: ODBC Maintainer?

From
Thomas Lockhart
Date:
> Hey, who is the current active maintainer of the ODBC driver?

Unfortunately, there is no "current active maintainer". However, there
are several people who have offered to help at a level just under what
they felt would be required to be considered the project leader.

Volunteers are accepted ;)
                  - Thomas


Re: ODBC Maintainer?

From
Kevin Lo
Date:
Thomas Lockhart wrote:

>> Hey, who is the current active maintainer of the ODBC driver?
> 
> 
> Unfortunately, there is no "current active maintainer". However, there
> are several people who have offered to help at a level just under what
> they felt would be required to be considered the project leader.
> 
> Volunteers are accepted ;)

I'll be a volunteer to implement odbc driver. Just wondering why don't 
import unixODBC
code into Postgres src?

>                    - Thomas

- Kevin



Re: ODBC Maintainer?

From
The Hermit Hacker
Date:
On Fri, 17 Nov 2000, Kevin Lo wrote:

> Thomas Lockhart wrote:
> 
> >> Hey, who is the current active maintainer of the ODBC driver?
> > 
> > 
> > Unfortunately, there is no "current active maintainer". However, there
> > are several people who have offered to help at a level just under what
> > they felt would be required to be considered the project leader.
> > 
> > Volunteers are accepted ;)
> 
> I'll be a volunteer to implement odbc driver. Just wondering why don't 
> import unixODBC
> code into Postgres src?

If I recall correctly, it is under GPL, no?  Which conflicts with our BSD
liccense ... of course, I've been known to recall incorrectly at times :)




Re: ODBC Maintainer?

From
Thomas Lockhart
Date:
> I'll be a volunteer to implement odbc driver. Just wondering why don't
> import unixODBC code into Postgres src?

That is possible, I suppose. 

My (admittedly vague) recollection is that the unixODBC folks took the
psqlODBC code from our tree and modified it. They may have contributed
back some patches, but afaik they forked the code and had no interest in
keeping the code base consistant :(

If the unixODBC code is a superset of what we have (or could be made so)
then perhaps it would be a better choice to work from. But we should
make sure that our last year's improvements don't get lost.
                    - Thomas


Re: ODBC Maintainer?

From
Max Khon
Date:
hi, there!

On Fri, 17 Nov 2000, Thomas Lockhart wrote:

> > I'll be a volunteer to implement odbc driver. Just wondering why don't
> > import unixODBC code into Postgres src?
> 
> That is possible, I suppose. 
> 
> My (admittedly vague) recollection is that the unixODBC folks took the
> psqlODBC code from our tree and modified it. They may have contributed
> back some patches, but afaik they forked the code and had no interest in
> keeping the code base consistant :(

most of their changes are bugfixes and changes related to '//' comments
used in PostgreSQL ODBC code. My impression is that Nick Gorham
<nick@easysoft.com> (unixODBC maintainer) is interested in merging ODBC
drivers and on their webpage it is stated that changes are submitted back
to PostgreSQL developers. The only issue might be license (unixODBC is
LGPL).

OTOH I do not understand why ODBC driver is not using libpq.
There were a couple of problems with ODBC driver backend protocol 
implementation (e.g. not reporting referential integrity
errors)

> If the unixODBC code is a superset of what we have (or could be made so)
> then perhaps it would be a better choice to work from. But we should
> make sure that our last year's improvements don't get lost.

/fjoe



Re: ODBC Maintainer?

From
Kevin Lo
Date:
The Hermit Hacker wrote:

> On Fri, 17 Nov 2000, Kevin Lo wrote:
> 
>> Thomas Lockhart wrote:
>> 
>>>> Hey, who is the current active maintainer of the ODBC driver?
>>> 
>>> 
>>> Unfortunately, there is no "current active maintainer". However, there
>>> are several people who have offered to help at a level just under what
>>> they felt would be required to be considered the project leader.
>>> 
>>> Volunteers are accepted ;)
>> 
>> I'll be a volunteer to implement odbc driver. Just wondering why don't 
>> import unixODBC
>> code into Postgres src?
> 
> 
> If I recall correctly, it is under GPL, no?  Which conflicts with our BSD
> liccense ... of course, I've been known to recall incorrectly at times :)

Well, it's under GPL. You recalled incorrectly :-)

- Kevin




Re: ODBC Maintainer?

From
Ned Lilly
Date:
Actually, it's LGPL...


The Hermit Hacker wrote:

> If I recall correctly, it is under GPL, no?  Which conflicts with our BSD
> liccense ... of course, I've been known to recall incorrectly at times :)



Re: ODBC Maintainer?

From
Peter Eisentraut
Date:
The Hermit Hacker writes:

> If I recall correctly, it is under GPL, no?  Which conflicts with our BSD
> liccense ... of course, I've been known to recall incorrectly at times :)

Our ODBC driver is under the LGPL, same as unixODBC.  There are no
"conflicts" as long as you don't copy code back and forth.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



Re: ODBC Maintainer?

From
"Ross J. Reedstrom"
Date:
On Fri, Nov 17, 2000 at 09:09:03PM +0100, Peter Eisentraut wrote:
> The Hermit Hacker writes:
> 
> > If I recall correctly, it is under GPL, no?  Which conflicts with our BSD
> > liccense ... of course, I've been known to recall incorrectly at times :)
> 
> Our ODBC driver is under the LGPL, same as unixODBC.  There are no
> "conflicts" as long as you don't copy code back and forth.


Err, 'back and forth between the core and ODBC drivers', I presume?

Ross
-- 
Open source code is like a natural resource, it's the result of providing
food and sunshine to programmers, and then staying out of their way.
[...] [It] is not going away because it has utility for both the developers 
and users independent of economic motivations.  Jim Flynn, Sunnyvale, Calif.