# Problem saving data

**URL:** <https://forum.servoy.com/t/problem-saving-data/13495>\
**Category:** Classic Servoy\
**Created:** [January 27, 2011, 10:35am UTC](https://forum.servoy.com/t/problem-saving-data/13495 "2011-01-27T10:35:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![michel](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@michel](https://forum.servoy.com/u/michel)\
**Post date:** [January 27, 2011, 10:35am UTC](https://forum.servoy.com/t/problem-saving-data/13495/1 "2011-01-27T10:35:35Z")

</div>

When copying multiple records from sybase to postgreSQL I get this error:

```auto
org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x00 Hint: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".

```

It happens when I issue the databaseManager.saveData()

The source table contains a TEXT-field that sometimes contains ‘strange’ characters as a result of a conversion, this conversion was done by a Servoy solution.

Has anyone seen this problem?

---

<div class="post-metadata">

**Author:** ![rgansevles](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rgansevles](https://forum.servoy.com/u/rgansevles)\
**Post date:** [January 28, 2011, 8:14am UTC](https://forum.servoy.com/t/problem-saving-data/13495/2 "2011-01-28T08:14:10Z")

</div>

Michel,

The contents of the sybase field seems to be stored as a binary data (what is the column type in the db?).  
When strings are stored in bytes, they are always converted using an encoding and when the bytes are converted to strings again, the same encoding must be used.

If you copy the bytes from one binary column to another and the second column expects another encoding than the one that was used, i can imagine this error.

How were both columns created?

Rob

---

<div class="post-metadata">

**Author:** ![michel](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@michel](https://forum.servoy.com/u/michel)\
**Post date:** [January 28, 2011, 9:08am UTC](https://forum.servoy.com/t/problem-saving-data/13495/3 "2011-01-28T09:08:56Z")

</div>

Hi Rob,

Both fields were created by Servoy, source and destination are TEXT(5000), columntype in posgreSQL: character varying(5000), columntype in sybase: varchar(5000).

Source database url: jdbc:sybase:Tds:localhost:2638?ServiceName=user\_data&CHARSET=utf8  
Destination database url: jdbc:postgresql://localhost:5432/user\_data

Source table was filled by a Servoy solution that copied data from a foxpro table to the sybase database. No problems occurred during this copy. The string fields containing the 0x00 characters were already present in the foxpro table.

---

<div class="post-metadata">

**Author:** ![rgansevles](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rgansevles](https://forum.servoy.com/u/rgansevles)\
**Post date:** [January 31, 2011, 9:38am UTC](https://forum.servoy.com/t/problem-saving-data/13495/4 "2011-01-31T09:38:02Z")

</div>

Michel,

When the sybase column is types as varchar, we get the string from the driver, not the bytes, so the bytes should already be converted by the sybase driver.

Do you use the latest postgres driver?  
We updated the driver in Servoy 5.2.3, the new driver size is 502694.

Rob

---

<div class="post-metadata">

**Author:** ![michel](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@michel](https://forum.servoy.com/u/michel)\
**Post date:** [January 31, 2011, 10:07am UTC](https://forum.servoy.com/t/problem-saving-data/13495/5 "2011-01-31T10:07:03Z")

</div>

Yes we are using Servoy 5.2.4. I checked the filesize of the postgresql.jar it is 502694 bytes.

So you mean the driver of sybase did not generate correct utf8?

---

<div class="post-metadata">

**Author:** ![rgansevles](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rgansevles](https://forum.servoy.com/u/rgansevles)\
**Post date:** [January 31, 2011, 11:08am UTC](https://forum.servoy.com/t/problem-saving-data/13495/6 "2011-01-31T11:08:12Z")

</div>

Michel,

I think the data is not correctly encoded in UTF8 in the sybase table, but it is being interpreted as UTF8.  
Do you have an idea what the encoding could be?

Rob

---

<div class="post-metadata">

**Author:** ![michel](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@michel](https://forum.servoy.com/u/michel)\
**Post date:** [January 31, 2011, 2:44pm UTC](https://forum.servoy.com/t/problem-saving-data/13495/7 "2011-01-31T14:44:48Z")

</div>

No, I don’t. We have always provide the UTF8 encoding in the sybase connection URL and we are using the sybase database shipped with servoy.

Connection URL of the foxpro database (thas served as the source for the sybase database) is jdbc:dbf:/c:\<some\_path\>?charSet=ISO8859\_1 using the com.hxtt.sql.dbf.DBFDriver
