Giter Site home page Giter Site logo

Comments (7)

filiprem avatar filiprem commented on May 22, 2024

I have observed this bug while connecting to Azure SQL .

  • tds_fdw v 1.0.1,
  • freetds v0.91,
  • PostgreSQL v. 9.3.5

I can connect to MyApp database from command line with tsql:

tsql -H gsnza2xxxx.database.windows.net -U 'uuuu@gsnza2xxxx' -D MyApp -P 'xxxx' -p 1433

But on SQL level, with TDS FDW I always get connected to "master" database.

I cannot modify default login database in Azure.

Is there a way to force an equivalent of -D MyApp on tds_fdw?

Should it be possible to specify database name on CREATE SERVER stage, not on CREATE FOREIGN TABLE stage?

Is it much work to do? Maybe it would be possible to add database option in tdsSetupConnection?

from tds_fdw.

GeoffMontee avatar GeoffMontee commented on May 22, 2024

I have started a discussion with the FreeTDS developers about this problem:

http://lists.ibiblio.org/pipermail/freetds/2015q2/029353.html

from tds_fdw.

GeoffMontee avatar GeoffMontee commented on May 22, 2024

The FreeTDS developer said that DBSETLDBNAME() can be used to add the connecting database to the LOGINREC prior to calling dbopen(). This macro/function appears to be undocumented in the current FreeTDS Doxygen reference manual, but I see that the macro at least exists in sybdb.h included in the version of FreeTDS in CentOS 7.

I'm thinking that I should make the DBSETLDBNAME() behavior the default. Maybe the dbuse() behavior could be turned on via a foreign server or table option.

from tds_fdw.

GeoffMontee avatar GeoffMontee commented on May 22, 2024

Hi @filiprem,

Can you please try the latest commit? I've added database and dbuse options for foreign servers. To support Azure, dbuse has to be set to 0 (the default).

Commit: c534888

e.g. with this commit, you can provide more options to CREATE SERVER:

CREATE SERVER mssql_svr
    FOREIGN DATA WRAPPER tds_fdw
    OPTIONS (servername '192.168.1.101', port '1433', 
    language 'us_english', character_set 'UTF-8', 
    database 'tds_fdw_test', tds_version '7.1');

from tds_fdw.

GeoffMontee avatar GeoffMontee commented on May 22, 2024

Direct links to archives of the commit:

from tds_fdw.

GeoffMontee avatar GeoffMontee commented on May 22, 2024

Fixed in version 1.0.2.

from tds_fdw.

filiprem avatar filiprem commented on May 22, 2024

Thank you Geoff! This works fine now.

from tds_fdw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.