Skip to Content.
Sympa Menu

freetds - [freetds] FreeTDS - freebcp issues

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Glenn, Chris" <Glenn AT addsys.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] FreeTDS - freebcp issues
  • Date: Wed, 25 Jan 2006 08:46:59 -0500

Freebcp enhancement request;
When using the '-e filename' option , don't create the
error file unless an actual error occurs. This is the behavior of the
Sybase bcp utility.

Problem;
The 'Nightly Snapshot' version of bcp 'in' does not seem to work. It
reports no error but does not actually bcp in any rows. The Stable
Release version (0.63) works correctly. I am working on a Redhat Linux
platform connecting to a MS SQL Server.

Below are the my details of the problem;

Sample I - Using the latest Nightly Snapshot
1029> cat bcpin_script
#!/bin/csh

bcp "CGTEST..AKA" in AKA.BCP \
-c \
-U CGTEST \
-P CGTEST \
-S CHAOS \
-t "~|" \
-m 1000 \
-e AKA.ERR
exit
1030> cat AKA.BCP
100~|C~|C~|100LBCYL~|0~|A~|01/17/2006~|INITIAL_LOAD
1031> setenv TDSDUMP BCPTEST

1032> source bcpin_script

Starting copy...

0 rows copied. <== Notice 0 rows, s/b 1
1033>

Excerpt from the TDS Log output;
...
util.c:119:Changing query state from
IDLE to QUERYING
mem.c:519:tds_free_all_results()
write.c:134:tds_put_string converting 8
bytes of "aka_code"
write.c:162:tds_put_string wrote 16
bytes
write.c:134:tds_put_string converting 8
bytes of "mfg_code"
write.c:162:tds_put_string wrote 16
bytes
write.c:134:tds_put_string converting 10
bytes of "group_code"
write.c:162:tds_put_string wrote 20
bytes
write.c:134:tds_put_string converting 8
bytes of "stock_id"
write.c:162:tds_put_string wrote 16
bytes
write.c:134:tds_put_string converting 8
bytes of "AKA_lock"
write.c:162:tds_put_string wrote 16
bytes
write.c:134:tds_put_string converting 6
bytes of "status"
write.c:162:tds_put_string wrote 12
bytes
write.c:134:tds_put_string converting 19
bytes of "last_maintenance_dt"
write.c:162:tds_put_string wrote 38
bytes
write.c:134:tds_put_string converting 23
bytes of "last_maintenance_userid"
write.c:162:tds_put_string wrote 46
bytes
bcp.c:1089:parsing host column 1
bcp.c:1148:prefix_len = 0 collen = 0
bcp.c:1180:_bcp_measure_terminated_field
returned -1! <== Notice 'failure'
net.c:673:Sending packet
...

Sample II - Using the Stable (0.63) Version
1035> source bcpin_script

Starting copy...

1 rows copied. <== Notice 1 row.
1036>

Excerpt From the TDS Log output;
...
15:14:11.185281 tds_process_end() state
set to TDS_IDLE
15:14:11.185294
tds_process_result_tokens() state is COMPLETED
15:14:11.185308 current_record_size = 76
15:14:11.185321 bcp_record_size = 76
15:14:11.185335 tds_put_string
converting 8 bytes of "aka_code"
15:14:11.185350 tds_put_string wrote 16
bytes
15:14:11.185365 tds_put_string
converting 8 bytes of "mfg_code"
15:14:11.185379 tds_put_string wrote 16
bytes
15:14:11.185393 tds_put_string
converting 10 bytes of "group_code"
15:14:11.185408 tds_put_string wrote 20
bytes
15:14:11.185422 tds_put_string
converting 8 bytes of "stock_id"
15:14:11.185436 tds_put_string wrote 16
bytes
15:14:11.185450 tds_put_string
converting 8 bytes of "AKA_lock"
15:14:11.185465 tds_put_string wrote 16
bytes
15:14:11.185479 tds_put_string
converting 6 bytes of "status"
15:14:11.185493 tds_put_string wrote 12
bytes
15:14:11.185507 tds_put_string
converting 19 bytes of "last_maintenance_dt"
15:14:11.185522 tds_put_string wrote 38
bytes
15:14:11.185537 tds_put_string
converting 23 bytes of "last_maintenance_userid"
15:14:11.185551 tds_put_string wrote 46
bytes
15:14:11.185579 parsing host column 1
15:14:11.185594 prefix_len = 0 collen =
0
15:14:11.185630
_bcp_measure_terminated_field returned 3 <== Notice
return value=3
15:14:11.185645 Adjusted collen is 3.
15:14:11.185658 tds_iconv_fread: read 3
of 3 bytes; outbuf has 3 left.
15:14:11.185677 Data read from hostfile:
collen is now 3, data_is_null is 0
15:14:11.185692 dbconvert(47 [SYBCHAR]
len 3 => 47 [SYBCHAR] len 12)
15:14:11.185707 dbconvert() srctype ==
desttype
...

>From my investigation, the following line seems to be the important
difference in the log files;

Nightly Snapshop Version; bcp.c:1180:_bcp_measure_terminated_field
returned -1!
Stable (0.64) Version; 15:14:11.185630 _bcp_measure_terminated_field
returned 3





Archive powered by MHonArc 2.6.24.

Top of Page