Skip to Content.
Sympa Menu

freetds - Re: [freetds] freebcp fails silently

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] freebcp fails silently
  • Date: Thu, 1 Nov 2007 19:53:53 -0400

Jonathan Gordon wrote:
> However, when all of that is correct and I run freebcp I don't receive
> any errors but no data gets uploaded.
...
> I receive the same lack of response when I set the environment variable
> TDSVER=7.0 or TDSVER=8.0. Using any other TDSVER yields:
>
> *** Begin error message ***
> Msg -100, Level 11
> unrecognized msgno
> *** End error message ***

(That's normal, indicates TDSVER 4.2. You get a better message with any
recent snapshot.)


> Here's the command I'm running: [modified]
> freebcp "mailing_analysis..MATCH_MAILING_CAMPAIGN" in \
> [...]/20071031.txt.out \
> -Usa -Pxxxxxx -S192.168.15.100:1433 \
> -f [...]/bcp.format" -m 1 -F 1

The file you attached had four newlines at the end.

$ tail /tmp/20071031.txt.out | hexdump -C
44 32 5a 36 30 37 09 78 78 78 79 7a 4c 41 53 54 |D2Z607.xxxyzLAST|
4e 41 4d 45 09 46 49 52 53 54 4e 41 4d 45 09 09 |NAME.FIRSTNAME..|
31 32 33 34 20 41 56 45 20 50 45 44 52 4f 20 41 |1234 AVE PEDRO A|
4c 42 49 5a 20 53 54 20 32 09 41 47 55 41 44 49 |LBIZ ST 2.AGUADI|
4c 4c 41 09 50 52 09 30 30 36 30 33 09 09 31 32 |LLA.PR.00603..12|
33 34 20 41 56 45 20 50 45 44 52 4f 20 41 4c 42 |34 AVE PEDRO ALB|
49 5a 20 32 09 46 49 52 53 54 4e 41 4d 45 20 58 |IZ 2.FIRSTNAME X|
58 58 59 5a 4c 41 53 54 4e 41 4d 45 09 32 37 09 |XXYZLASTNAME.27.|
32 30 09 38 0a 0a 0a 0a |20.8....|

The -F 1 doesn't prevent freebcp from reading the other lines. You run a
high probability of confusing its line parser, compounded by the use of a
format file. (The format file is entirely supported, but I suspect less
used, so error handling in its presence might not be all it could be.)

To make things ever so slightly more painful, I'm pretty sure -L
processing is broken in 0.64 (but should work nowadays). So you have to
trim the datafile.

If you drop "-m1 -F1" and trim 20071031.txt.out, does the program then
work?


Finally, as a recommendation, set up your freetds.conf so you can connect
to your server by name, rather than specifying all the parameters on the
command line. That will help prevent running afoul of TDSVER issues, and
-- always the clincher -- save typing.

Nice problem report, btw. :-)

HTH.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page