Thread: trrouble inserting stuff like é
I wrote a program to read my database (from MSSQL) and write it to Postgres. It appeared to work great the first time I ran it, but the database was SQL_ASCII (It defaulted to this when I created it from the command line on the linux box using createdb. When I tried to restore it I used PGAdmin on my XP machine which created a Unicode database. I was unable to restore the SQL_ASCII to the Unicode, so I re-ran my import on a Unicode database. Now I get all kinds of errors from the .net program (which I have write out the actual SQL on each error). When I cut and paste the SQL into PGADMIN it runs ok, so it only gives an error using .net ODBC. Any one have any clues for me to follow? Here is an example of a SQL line that did not run in .net. insert into tblSuspectedActivity(ClientNum,ID,Value,IsDeleted,PresentationID) values('FREN',4,'Paiement à account',False,2) Joel Fradkin
Hi, I use LATIN1 encoding and it works fine with accented characters. So try creating your db with -E LATIN1 switch. Or even initdb -E LATIN1 if you wan't your dbs default to that. Best regards, Aarni On Friday 18 February 2005 16:59, you wrote: > I wrote a program to read my database (from MSSQL) and write it to > Postgres. It appeared to work great the first time I ran it, but the > database was SQL_ASCII (It defaulted to this when I created it from the > command line on the linux box using createdb. > > When I tried to restore it I used PGAdmin on my XP machine which created a > Unicode database. > I was unable to restore the SQL_ASCII to the Unicode, so I re-ran my import > on a Unicode database. > Now I get all kinds of errors from the .net program (which I have write out > the actual SQL on each error). > When I cut and paste the SQL into PGADMIN it runs ok, so it only gives an > error using .net ODBC. > > Any one have any clues for me to follow? > > Here is an example of a SQL line that did not run in .net. > > insert into > tblSuspectedActivity(ClientNum,ID,Value,IsDeleted,PresentationID) > values('FREN',4,'Paiement à > account',False,2) > > Joel Fradkin > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly -------------- This is a bugfree broadcast to you from **Kmail** on **Fedora Core 2** linux system --------------
I dont think it has anything to do with the data base as I can add fine from pgadmin its an odbc question. How do I tell the connection to use Unicode? It worked ok using SQL_ASCHII also with the driver, but I thought if we get a Chinese client down the road I couldnt store those chars unless its Unicode? Joel Fradkin Wazagua, Inc. 2520 Trailmate Dr Sarasota, Florida 34243 Tel. 941-753-7111 ext 305 jfradkin@wazagua.com www.wazagua.com Powered by Wazagua Providing you with the latest Web-based technology & advanced tools. © 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc This email message is for the use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and delete and destroy all copies of the original message, including attachments. -----Original Message----- From: Aarni Ruuhimäki [mailto:aarni@kymi.com] Sent: Friday, February 18, 2005 10:25 AM To: Joel Fradkin Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] trrouble inserting stuff like é Hi, I use LATIN1 encoding and it works fine with accented characters. So try creating your db with -E LATIN1 switch. Or even initdb -E LATIN1 if you wan't your dbs default to that. Best regards, Aarni On Friday 18 February 2005 16:59, you wrote: > I wrote a program to read my database (from MSSQL) and write it to > Postgres. It appeared to work great the first time I ran it, but the > database was SQL_ASCII (It defaulted to this when I created it from the > command line on the linux box using createdb. > > When I tried to restore it I used PGAdmin on my XP machine which created a > Unicode database. > I was unable to restore the SQL_ASCII to the Unicode, so I re-ran my import > on a Unicode database. > Now I get all kinds of errors from the .net program (which I have write out > the actual SQL on each error). > When I cut and paste the SQL into PGADMIN it runs ok, so it only gives an > error using .net ODBC. > > Any one have any clues for me to follow? > > Here is an example of a SQL line that did not run in .net. > > insert into > tblSuspectedActivity(ClientNum,ID,Value,IsDeleted,PresentationID) > values('FREN',4,'Paiement à > account',False,2) > > Joel Fradkin > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly -------------- This is a bugfree broadcast to you from **Kmail** on **Fedora Core 2** linux system --------------
Looking deeper into the matter (which I admit I am a bit ignorant on) I think you hit the nail on the head. Coming from MSSQL which is using Latin I may have to use Latin1. It works ok as SQL_ASCHII, but lower does not work, so hopefully using LATIN1 I can store the chars and also get lower to work etc. Thanks so much for the help. I have been very confused as I could create a Unicode db and even save the French values using pgadmin or .net connection, but the odbc would not work. I hope it works ok with the LATIN1. -----Original Message----- From: Aarni Ruuhimäki [mailto:aarni@kymi.com] Sent: Friday, February 18, 2005 10:25 AM To: Joel Fradkin Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] trrouble inserting stuff like é Hi, I use LATIN1 encoding and it works fine with accented characters. So try creating your db with -E LATIN1 switch. Or even initdb -E LATIN1 if you wan't your dbs default to that. Best regards, Aarni On Friday 18 February 2005 16:59, you wrote: > I wrote a program to read my database (from MSSQL) and write it to > Postgres. It appeared to work great the first time I ran it, but the > database was SQL_ASCII (It defaulted to this when I created it from the > command line on the linux box using createdb. > > When I tried to restore it I used PGAdmin on my XP machine which created a > Unicode database. > I was unable to restore the SQL_ASCII to the Unicode, so I re-ran my import > on a Unicode database. > Now I get all kinds of errors from the .net program (which I have write out > the actual SQL on each error). > When I cut and paste the SQL into PGADMIN it runs ok, so it only gives an > error using .net ODBC. > > Any one have any clues for me to follow? > > Here is an example of a SQL line that did not run in .net. > > insert into > tblSuspectedActivity(ClientNum,ID,Value,IsDeleted,PresentationID) > values('FREN',4,'Paiement à > account',False,2) > > Joel Fradkin > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly -------------- This is a bugfree broadcast to you from **Kmail** on **Fedora Core 2** linux system --------------
On Feb 18, 2005, at 11:15 AM, Joel Fradkin wrote: > How do I tell the connection to use Unicode? Try SET client_encoding TO 'UNICODE'; http://www.postgresql.org/docs/8.0/interactive/sql-set.html But it should default to the database encoding, so I'm not sure if that is the problem. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL
I did that and it did not work. On the .net driver I had to do it on the connect string. I also just tested latin and see the lower and upper do not work on the French chars, while upper and lower do work on the French chars on a Unicode database. So the problem is getting the odbc driver to work with Unicode. Worst case I will just use SQL_ASCHII, I am guessing the ODBC driver does not have a encoding command like the .net one does. Joel Fradkin Wazagua, Inc. 2520 Trailmate Dr Sarasota, Florida 34243 Tel. 941-753-7111 ext 305 jfradkin@wazagua.com www.wazagua.com Powered by Wazagua Providing you with the latest Web-based technology & advanced tools. © 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc This email message is for the use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and delete and destroy all copies of the original message, including attachments. -----Original Message----- From: John DeSoi [mailto:desoi@pgedit.com] Sent: Friday, February 18, 2005 3:42 PM To: Joel Fradkin Cc: aarni@kymi.com; pgsql-sql@postgresql.org Subject: Re: [SQL] RE: [SQL] trrouble inserting stuff like é On Feb 18, 2005, at 11:15 AM, Joel Fradkin wrote: > How do I tell the connection to use Unicode? Try SET client_encoding TO 'UNICODE'; http://www.postgresql.org/docs/8.0/interactive/sql-set.html But it should default to the database encoding, so I'm not sure if that is the problem. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL
Hi, Glad I could help. I am no expert on this stuff either, but after some experiment LATIN1 is what I ended up using. Works with Scandinavian and German umlauts too and even with russian characters. I create my dbs manually via terminal and clients access them with browser interface through internet. We are using RH, FC2 and TSL (Trustix Secure Linux) as servers. BR, Aarni On Friday 18 February 2005 22:37, you wrote: > Looking deeper into the matter (which I admit I am a bit ignorant on) I > think you hit the nail on the head. > Coming from MSSQL which is using Latin I may have to use Latin1. > It works ok as SQL_ASCHII, but lower does not work, so hopefully using > LATIN1 I can store the chars and also get lower to work etc. > > Thanks so much for the help. > > I have been very confused as I could create a Unicode db and even save the > French values using pgadmin or .net connection, but the odbc would not > work. I hope it works ok with the LATIN1. > > > -----Original Message----- > From: Aarni Ruuhimäki [mailto:aarni@kymi.com] > Sent: Friday, February 18, 2005 10:25 AM > To: Joel Fradkin > Cc: pgsql-sql@postgresql.org > Subject: Re: [SQL] trrouble inserting stuff like é > > Hi, > > I use LATIN1 encoding and it works fine with accented characters. So try > creating your db with -E LATIN1 switch. Or even initdb -E LATIN1 if you > wan't > your dbs default to that. > > Best regards, > > Aarni > > On Friday 18 February 2005 16:59, you wrote: > > I wrote a program to read my database (from MSSQL) and write it to > > Postgres. It appeared to work great the first time I ran it, but the > > database was SQL_ASCII (It defaulted to this when I created it from the > > command line on the linux box using createdb. > > > > When I tried to restore it I used PGAdmin on my XP machine which created > > a Unicode database. > > I was unable to restore the SQL_ASCII to the Unicode, so I re-ran my > > import > > > on a Unicode database. > > Now I get all kinds of errors from the .net program (which I have write > > out > > > the actual SQL on each error). > > When I cut and paste the SQL into PGADMIN it runs ok, so it only gives an > > error using .net ODBC. > > > > Any one have any clues for me to follow? > > > > Here is an example of a SQL line that did not run in .net. > > > > insert into > > tblSuspectedActivity(ClientNum,ID,Value,IsDeleted,PresentationID) > > values('FREN',4,'Paiement à > > account',False,2) > > > > Joel Fradkin > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 3: if posting/reading through Usenet, please send an appropriate > > subscribe-nomail command to majordomo@postgresql.org so that your > > message can get through to the mailing list cleanly > > -------------- > This is a bugfree broadcast to you > from **Kmail** > on **Fedora Core 2** linux system > -------------- .