dbTalk Databases Forums  

Sybase Openclient BCP error for different ase version

comp.databases.sybase comp.databases.sybase


Discuss Sybase Openclient BCP error for different ase version in the comp.databases.sybase forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
aykut
 
Posts: n/a

Default Sybase Openclient BCP error for different ase version - 10-08-2009 , 02:04 AM






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

Reply With Quote
  #2  
Old   
Bret_Halford
 
Posts: n/a

Default Re: Sybase Openclient BCP error for different ase version - 10-12-2009 , 11:11 AM






On Oct 8, 1:04*am, aykut <maykut... (AT) gmail (DOT) com> wrote:

Quote:
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

Reply With Quote
  #3  
Old   
SybaseNeal
 
Posts: n/a

Default Re: Sybase Openclient BCP error for different ase version - 10-14-2009 , 04:04 PM



Hello,

The Bulk-Library equivalent of bcp's -Y parameter is the "BLK_CONV"
property:
http://infocenter.sybase.com/help/to...lib/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/to...ref/X21080.htm

Thanks,
Neal

Reply With Quote
  #4  
Old   
aykut
 
Posts: n/a

Default Re: Sybase Openclient BCP error for different ase version - 10-15-2009 , 01:44 AM



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

Reply With Quote
  #5  
Old   
aykut
 
Posts: n/a

Default Re: Sybase Openclient BCP error for different ase version - 10-19-2009 , 12:50 AM



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:
Quote:
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.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.