freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Tony Baldarelli" <tbaldarelli AT wmsvision.com>
- To: "'Robert Hetzel'" <beh AT case.edu>
- Cc: 'FreeTDS Development Group' <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] tsql knowing which DB to default to
- Date: Thu, 11 Aug 2011 13:39:13 -0400
Actually, someone else mentioned at -D option. Because it was not in "man
tsql", I missed the command line option. Don't see it online either.
Weird. Your idea is still a good idea, so I may still end up using it if I
find some other problem that the -D option does not fix. Thanks.
Tony
From: Robert Hetzel [mailto:beh AT case.edu]
Sent: Wednesday, August 10, 2011 8:43 PM
To: tbaldarelli AT wmsvision.com
Subject: Re: [freetds] tsql knowing which DB to default to
Can you use a separate userids for each application, setting a different
default database for each?
Bob
On Wed, Aug 10, 2011 at 7:26 PM, Tony Baldarelli <tbaldarelli AT wmsvision.com>
wrote:
Hello,
For my production server, it just so happens that the
database I use is the default database. As such, I don't need to use the
following to connect to the correct database inside tsql:
use <database>
go
But now we have 2 other databases that just happen to be on the same server.
This requires me to use the "use <database>" pattern to connect to the
correct database. I thought this setup would get around that requirement,
but it does not:
[Wms_Stage]
host = PBMVMWMSSQLDEV
port = 1433
tds version = 8.0
database=WMS_STAGE
I actually think "database" is not supported as I don't see it in the
documentation online. So either that changed, or someone added it and then
never got rid of it since it does not seem to cause a problem. I want to
make my application ( including SQL scripts ) as blind as possible to the
database, but I cannot if I have to use the "use <database>" pattern for 2
databases, but not the production one. Is there a way to tell tsql to use a
particular database so I don't have to? Note that since "tsql" is run from
a special shell script ( called "sql" ), a perfectly valid option would be
to have a command line option to tsql that tells tsql to use a particular
database. Also, an environmental variable would also work, for this same
reason. Thanks. I could not see an obvious way to do it in the
documentation.
In case you are wondering, I commonly run a command like this: sql <
report.sql. Since "sql" is defined differently for each database (
actually, each Linux user ), I just want to be able to "run" the same sql
script against all 3 databases without any changes at all. Thus my
questions above. Here is an example of the "sql" script using the above
freetds.conf setup:
[wmsStage]> more sql
tsql -S Wms_Stage -U <user name removed for security> -P
<Password removed for security>
echo
[wmsStage]>
Tony Baldarelli
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
-
[freetds] tsql knowing which DB to default to,
Tony Baldarelli, 08/10/2011
-
Re: [freetds] tsql knowing which DB to default to,
Raymond R Rankins, 08/11/2011
- Re: [freetds] tsql knowing which DB to default to, Tony Baldarelli, 08/11/2011
-
Message not available
- Re: [freetds] tsql knowing which DB to default to, Tony Baldarelli, 08/11/2011
-
Re: [freetds] tsql knowing which DB to default to,
Raymond R Rankins, 08/11/2011
Archive powered by MHonArc 2.6.24.