freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] Problem with freebcp and fixed text output
- From: rodrigo lopez <rodrigoa AT yahoo.com>
- To: freetds AT lists.ibiblio.org
- Subject: Re: [freetds] Problem with freebcp and fixed text output
- Date: Wed, 5 Aug 2009 10:36:05 -0700 (PDT)
Para freebcp el TAB = \n
tray this:
Format file:
10.0
4
1 SYBCHAR 0 3 "\t" 1 term_code
2 SYBCHAR 0 6 "\t" 2 cbs_term_code
3 SYBCHAR 0 10 "\t" 3 description
4 SYBCHAR 0 24 "\n" 4 last_update_date
y funciona!! = ITS WORKS!!
Rodrigo Antonio López Olivares
Ingeniero en Informática
Licenciado en ciencias de la ingeniería.
UTEM
Cel: 06-2142337
--- El mié 5-ago-09, freetds-request AT lists.ibiblio.org
<freetds-request AT lists.ibiblio.org> escribió:
De: freetds-request AT lists.ibiblio.org <freetds-request AT lists.ibiblio.org>
Asunto: FreeTDS Digest, Vol 79, Issue 4
A: freetds AT lists.ibiblio.org
Fecha: miércoles, 5 agosto, 2009, 2:20 pm
Send FreeTDS mailing list submissions to
freetds AT lists.ibiblio.org
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.ibiblio.org/mailman/listinfo/freetds
or, via email, send a message with subject or body 'help' to
freetds-request AT lists.ibiblio.org
You can reach the person managing the list at
freetds-owner AT lists.ibiblio.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of FreeTDS digest..."
Today's Topics:
1. Problem with freebcp and fixed text output (Modesto Sevilla)
2. Host process hard coded to 37876 for Sybase (Wood, David)
3. Re: Building Sybperl against FreeTDS on Fedora (James K. Lowden)
----------------------------------------------------------------------
Message: 1
Date: Tue, 04 Aug 2009 16:37:39 -0700
From: Modesto Sevilla <mpsevill AT uci.edu>
Subject: [freetds] Problem with freebcp and fixed text output
To: freetds AT lists.ibiblio.org
Message-ID: <4A78C643.5000400 AT uci.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hello,
I am evaluating freebcp as a replacement to bcp (Sybase) while
connecting to MS Sql Server 2008. My problem is that when I bcp out a
table even if I specify a format file, the output does not come out in
fixed length as it did with bcp.
Here is an example:
Table:
create table testbcp
(
term_code char(3) NOT NULL,
cbs_term_code char(6) NOT NULL,
description char(10) NULL,
last_update_date datetime NULL
)
Format file:
10.0
4
1 SYBCHAR 0 3 "" 1 term_code
2 SYBCHAR 0 6 "" 2 cbs_term_code
3 SYBCHAR 0 10 "" 3 description
4 SYBCHAR 0 24 "\n" 4 last_update_date
Output when calling freebcp testbcp out testbcp.dat -f testbcp.fmt -S
SERVER -U USERNAME -P PW
093200901TESTING DE
094200902TEST2009-08-04 16:28:11.780
092200906NO DESC2009-08-04 16:28:11.780
But it should be fixed length like this:
093200901TESTING DE
094200902TEST 2009-08-04 16:28:11.780
092200906NO DESC 2009-08-04 16:28:11.780
For some reason it is not padding with spaces according to the format
file like the Sybase bcp tool does.
Can anyone help me?
------------------------------
Message: 2
Date: Wed, 5 Aug 2009 00:50:22 -0400
From: "Wood, David" <David.Wood AT deshaw.com>
Subject: [freetds] Host process hard coded to 37876 for Sybase
To: <freetds AT lists.ibiblio.org>
Message-ID:
<B74ECD8100C5D24483F94AAE2B90679005DA02 AT mailnyc3.nyc.deshaw.com>
Content-Type: text/plain; charset="us-ascii"
Hello,
It seems host process is currently hard coded to 37876 if using TDS <= 5
(eg Sybase):
% grep 37876 src/tds/login.c
tds_put_login_string(tds, "37876", TDS_MAX_LOGIN_STR_SZ);
/* host process */
% tsql -Ufoo -SSYB1 -Pbar
...
1> select hostprocess from sysprocesses where spid = @@spid
2> go
hostprocess
37876
^Z
% ps -ef | grep tsql | grep -v grep
woodd 2990 2832 0 00:38:09 pts/140 0:00 tsql -Ufoo -SSYB1
-Pbar
After applying the patch below:
% tsql -Ufoo -SSYB1 -Pbar
...
1> select hostprocess from sysprocesses where spid = @@spid
2> go
hostprocess
23294
^Z
% ps -ef | grep tsql | grep -v grep
woodd 23294 23233 0 00:41:47 pts/17 0:00 tsql -Ufoo -SSYB1
-Pbar
Context diff against CVS:
*** login.c Wed Aug 5 00:45:23 2009
--- login_patched.c Wed Aug 5 00:44:22 2009
***************
*** 29,34 ****
--- 29,38 ----
#include <stdlib.h>
#endif /* HAVE_STDLIB_H */
+ #ifdef HAVE_LIMITS_H
+ #include <limits.h>
+ #endif /* HAVE_LIMITS_H */
+
#include <assert.h>
#if HAVE_STRING_H
***************
*** 593,599 ****
tds_put_login_string(tds,
tds_dstr_cstr(&connection->client_host_name), TDS_MAX_LOGIN_STR_SZ); /*
client host name */
tds_put_login_string(tds, tds_dstr_cstr(&connection->user_name),
TDS_MAX_LOGIN_STR_SZ); /* account name */
tds_put_login_string(tds, tds_dstr_cstr(&connection->password),
TDS_MAX_LOGIN_STR_SZ); /* account password */
! tds_put_login_string(tds, "37876", TDS_MAX_LOGIN_STR_SZ);
/* host process */
#ifdef WORDS_BIGENDIAN
if (tds->emul_little_endian) {
tds_put_n(tds, le1, 6);
--- 597,605 ----
tds_put_login_string(tds,
tds_dstr_cstr(&connection->client_host_name), TDS_MAX_LOGIN_STR_SZ); /*
client host name */
tds_put_login_string(tds, tds_dstr_cstr(&connection->user_name),
TDS_MAX_LOGIN_STR_SZ); /* account name */
tds_put_login_string(tds, tds_dstr_cstr(&connection->password),
TDS_MAX_LOGIN_STR_SZ); /* account password */
! char pbuf[PID_MAX+1];
! sprintf(pbuf, "%d", (int) getpid());
! tds_put_login_string(tds, pbuf, TDS_MAX_LOGIN_STR_SZ); /* host
process */
#ifdef WORDS_BIGENDIAN
if (tds->emul_little_endian) {
tds_put_n(tds, le1, 6);
David
------------------------------
Message: 3
Date: Wed, 5 Aug 2009 06:02:27 -0400
From: "James K. Lowden" <jklowden AT freetds.org>
Subject: Re: [freetds] Building Sybperl against FreeTDS on Fedora
To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
Message-ID: <20090805060227.3952e614.jklowden AT freetds.org>
Content-Type: text/plain; charset=US-ASCII
Ed Avis wrote:
>
> %configure \
> --disable-dependency-tracking \
> --disable-rpath \
> %{!?_with_static: --disable-static} \
> --with-tdsver="4.2" \
> --with-unixodbc="%{_prefix}" \
> --enable-msdblib \
> --enable-sybase-compat \
> --with-gnutls
>
> Now, I do want to use FreeTDS to connect to an MSSQL server, so do I
> need to keep that flag in there?
http://www.freetds.org/userguide/config.htm#EVERYONE
As the UG says, these flags provide a small degree of compatibility. In
the case of msdblib, it adjusts the date structure; sybase-compat adds a
symbol.
So, no, you don't need --enable-msdblib to connect to a Microsoft server;
you need it only if you're working with code that expects Microsoft's
db-lib conventions. (That's why it's calls msdblib and not, say, ms-tds.)
Sybperl, on the contrary, expects Sybase db-lib conventions.
> If so, I guess Sybperl needs patching to build against a FreeTDS
> configured this way. I might go through the Sybperl source and add
> various #ifdef MSDBLIB sections. Does that sound a reasonable way to
> proceed?
Well, it *could* be. Easiest is to rebuild FreeTDS without those two
flags. Modifying Sybperl might possibly be of some service, in that it
would facilitate using Fedora as-is, or even potentially using Microsoft's
library.
HTH.
--jkl
------------------------------
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
End of FreeTDS Digest, Vol 79, Issue 4
**************************************
____________________________________________________________________________________
¡Obtén la mejor experiencia en la web!
Descarga gratis el nuevo Internet Explorer 8.
http://downloads.yahoo.com/ieak8/?l=e1
-
[freetds] Problem with freebcp and fixed text output,
Modesto Sevilla, 08/04/2009
-
Re: [freetds] Problem with freebcp and fixed text output,
James K. Lowden, 08/05/2009
- Re: [freetds] Problem with freebcp and fixed text output [NC], Cedric ROUVRAIS, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
Cedric ROUVRAIS, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
James K. Lowden, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
Cedric ROUVRAIS, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
Konrad J Hambrick, 08/06/2009
- Re: [freetds] Problem with freebcp and fixed text output [NC], Konrad J Hambrick, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
Cedric ROUVRAIS, 08/06/2009
- Re: [freetds] Problem with freebcp and fixed text output [NC], Konrad J Hambrick, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
Konrad J Hambrick, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
Cedric ROUVRAIS, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
James K. Lowden, 08/06/2009
- <Possible follow-up(s)>
- Re: [freetds] Problem with freebcp and fixed text output, rodrigo lopez, 08/05/2009
-
Re: [freetds] Problem with freebcp and fixed text output,
James K. Lowden, 08/05/2009
Archive powered by MHonArc 2.6.24.