Re: FreeBCP to SQL Azure complains table is missing?

Cade Roux <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <CAF-HO7MgtMBi7Lbtg6rX81NGMeKYZJpEHpHKOC-Vvt5JCQq=vg@mail.gmail.com>
Yes, that user's default database is probably master.  There IS a
default database set up in the odbc config, but I was mistaken, there
is no such option in the freeetds.conf.

We've moved away from trying to get Linux to work for this process for
now, but I'll revisit this.

I expect that workaround will not work because USE isn't supported -
you do in fact have to connect directly to the database, because of
the nature of the SQL Azure architecture.

Cade
Cade Roux
[email protected]
504-717-4887


On Tue, Nov 20, 2012 at 8:51 PM, James K. Lowden <[email protected]> wrote:
> On Sun, 18 Nov 2012 20:16:59 -0600
> Cade Roux <[email protected]> wrote:
>
>> Has anyone used FreeBCP to connect to SQL Azure?
>>
>> $ freebcp DWSTAGE.BCPTEST in bcptest.txt -f cdr.fmt -S
>> serverfromfreetds -U user@azureserver -P password
>> Msg 208, Level 16, State 1
>> Server 'azureserver', Line 1
>>     Invalid object name 'DWSTAGE.BCPTEST'.
>> Msg 208, Level 16
>> General SQL Server error: Check messages from the SQL Server
>
> The message 208 comes from the server.  A quick look at freebcp.c shows
> argv[1] isn't parsed.  It's copied to a struct and used verbatim e.g.
>
>                         if (dbfcmd(dbproc, "SET FMTONLY ON select *
> from %s SET FMTONLY OFF", pdata->dbobject) == FAIL)
>
> My guess is that the account you're logging in with has a default
> database, and that database is not the one containing DWSTAGE.BCPTEST.
> The Azure server rejects dbname.schema.object syntax, and freebcp has
> no -D option because until Azure every TDS server did accept that
> syntax.
>
> You could verify that using
>
>         $ freebcp 'select db_name()' queryout /dev/stdout ...
>
> As a temporary workaround, I think this would work:
>
>         freebcp DWSTAGE.BCPTEST in bcptest.txt \
>         -O 'USE dbname' \
>         -f cdr.fmt -S serverfromfreetds -U user@azureserver -P password
>
> A permanent fix would support -D.
>
> HTH.
>
> --jkl
> _______________________________________________
> FreeTDS mailing list
> [email protected]
> http://lists.ibiblio.org/mailman/listinfo/freetds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.