Re: Error When Trying to Use Npgsql to COPY into a PostgreSQL Database

From: Altec103 <goldenbabbler(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Error When Trying to Use Npgsql to COPY into a PostgreSQL Database
Date: 2014-06-24 20:37:23
Message-ID: 1403642243831-5808982.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adrian, I actually figured it out. It was a really silly mistake - basically
I was testing something earlier and edited my ODBC connection string. I was
actually connecting to the wrong database and it was an empty database, so
ODBCDataReader was trying to pull data from an empty table. Anyways, this is
fixed. However, I have a new problem.

I occasionally get an ERROR: 22021: invalid byte sequence for encoding
"UTF8": 0x92 when using the COPY query and this stops the whole process. It
occurs here in my code...

var raw = Encoding.UTF8.GetBytes(string.Concat(dataEntry, "\n"));
copy.CopyStream.Write(raw, 0, raw.Length);

dataEntry is a string. I have tried a few things to try and remove any
non-UTF8 characters from the string, but it has failed so far. Any ideas?

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Error-When-Trying-to-Use-Npgsql-to-COPY-into-a-PostgreSQL-Database-tp5808954p5808982.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-06-24 21:05:29 Re: Re: Error When Trying to Use Npgsql to COPY into a PostgreSQL Database
Previous Message ChoonSoo Park 2014-06-24 20:37:04 Can't start postgresql server