Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sybase Openclient BCP error for different ase version

594 views
Skip to first unread message

aykut

unread,
Oct 8, 2009, 3:04:59 AM10/8/09
to
hi,

i am coding C with using open client for database jobs on sybase and i
got some errors about charsets. My sybase server is ASE 15.02 and when
i run bcp from open client with blk_init, following errors are
followed.

Server message:
Message number: 4847, Severity 16, State 1, Line 1
Server 'SYBBLKTEST'
Message String: BCP insert operation is disabled when data size is
changing between client and server character sets. Please use BCP's -Y
option to invoke client-side conversion.

Server message:
Message number: 3621, Severity 10, State 0, Line 1
Server 'SYBBLKTEST'
Message String: Command has been aborted.

Open Client Message:
Message number: LAYER = (0) ORIGIN = (0) SEVERITY = (0) NUMBER = (0)
Message String: blk_init(): blk layer: CT library error: Failed when
CT_Lib routine ct_results() called.
ERROR: BulkCopyIn: blk_init() failed

On the other hand, I have to keep server's default character set as
iso_1. i can not change default char set. Ok. When i use -Y option in
BCP command from command line , error is gone. but i use open client
library from C and i couldnt find any parameter for define some option
like -Y for blk_init or blk_props or other functions. How can i
handle that?

regards
aykut

Bret_Halford

unread,
Oct 12, 2009, 12:11:54 PM10/12/09
to
On Oct 8, 1:04 am, aykut <maykut...@gmail.com> wrote:

> On the other hand, I have to keep server's default character set as
> iso_1. i can not change default char set.  Ok. When i use -Y option in
> BCP command from command line , error is gone. but i use open client
> library from C and i couldnt find any parameter for define some option
> like -Y for blk_init or blk_props or other  functions. How can i
> handle that?
>
> regards
> aykut

I'm not an expert in Open Client, but my guess would be that you would
use cs_manage_convert
to convert on the client side from your multi-byte character set to
iso_1.

-bret

SybaseNeal

unread,
Oct 14, 2009, 5:04:33 PM10/14/09
to mayk...@gmail.com
Hello,

The Bulk-Library equivalent of bcp's -Y parameter is the "BLK_CONV"
property:
http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc32850.1500/html/comlib/X72074.htm

It essentially says that the client will perform character set
conversion instead of the server.

If you enable this property, you may also want to set
CS_NOCHARSETCNV_REQD=CS_TRUE so that
character conversion is not attempted at the server level:
http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc32840.1500/html/ctref/X21080.htm

Thanks,
Neal

aykut

unread,
Oct 15, 2009, 2:44:32 AM10/15/09
to
Thank you Neal and Bret

I am so sorry to be late for share another solution about this
subject. Anyway, your suggestion seems the best way Neal.

The other solution that i have used;

CS_LOCALE *G_locale;
cs_locale( contextPtr, CS_SET, G_locale, CS_SYB_LANG,"us_english",
CS_NULLTERM,(CS_INT*)NULL);
cs_locale( contextPtr, CS_SET, G_locale, CS_SYB_CHARSET,"utf8",
CS_NULLTERM,(CS_INT*)NULL);
ct_con_alloc(...);
ct_con_props( connectionPtr, CS_SET, CS_LOC_PROP, G_locale,
CS_UNUSED, NULL);

...

Thanks and best regards.
Aykut

aykut

unread,
Oct 19, 2009, 1:50:49 AM10/19/09
to
Thanks Neal. I aggre wih you. When I go one step forward in my tests,
some data corruptions occured. I am rewriting the code. Thank you
again.

Best regards
Aykut

SybaseNeal wrote:
> Yes, if your client and server character sets match than no character
> set conversion will take place.
>
> But if your data is actually a different character set, let say sjis
> for some Japanese data, you would
> not want to set your client character set to utf8 just to get past the
> conversion restrictions. This
> could cause the data to be stored improperly.
>
> Ideally, you want your client character set to be the same character
> set as your data.

0 new messages