[freetds] FreeBCP to SQL Azure complains table is missing?

Cade Roux cade at roux.org
Tue Nov 20 22:04:39 EST 2012


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
cade at roux.org
504-717-4887


On Tue, Nov 20, 2012 at 8:51 PM, James K. Lowden <jklowden at freetds.org> wrote:
> On Sun, 18 Nov 2012 20:16:59 -0600
> Cade Roux <cade at roux.org> wrote:
>
>> Has anyone used FreeBCP to connect to SQL Azure?
>>
>> $ freebcp DWSTAGE.BCPTEST in bcptest.txt -f cdr.fmt -S
>> serverfromfreetds -U user at 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 at azureserver -P password
>
> A permanent fix would support -D.
>
> HTH.
>
> --jkl
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds


More information about the FreeTDS mailing list