Skip to Content.
Sympa Menu

freetds - Re: [freetds] Executing a huge sql script

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: David Chang <dchang AT fsautomation.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] Executing a huge sql script
  • Date: Mon, 18 Nov 2013 17:30:41 -0800

Chris,

What configuration items are you trying to mix in the freetds.conf file? Could you provide an example?

I thought there were just three basic items you needed to connect to a server:

[SERVER_LABEL]
host = <hostname>
port = <TCP port>
tds version = <version number>

In addition, the tds version can be put in the [global] section so you don't have to specify it for every server. As for multiple users, so long as you create a unique SERVER_LABEL and put all the configuration in there, you are insulated from the the other servers as well as the [global] section.

DC

On 11/18/2013 4:41 PM, Chris Kings-Lynne wrote:
Using freetds.conf is horrible. It mixes together code-level configuration
with system root-level static files. It doesn't work when you have dozens of
developers sharing a single Vagrant environment definition, but different SQL
servers. It doesn't work when you are stamping out lots of instances in the
cloud, etc. I have resorted to using TDSPORT and TDSHOST, but I'm not yet
100% sure of what exactly the scope of setting the environment variable is,
will it conflict with multiple different database connections, all set to
only connect on demand, etc.

I'm firing up a dev linux VM now to look at adding host and port settings,
which I'll try to do over time. I also need to do my own build of freetds
anyway so my developers can actually have error messages in PHP as per my
first mail to this list :(

Chris

-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of James K. Lowden
Sent: Monday, 18 November 2013 1:18 PM
To: freetds AT lists.ibiblio.org
Subject: Re: [freetds] Executing a huge sql script

On Sun, 17 Nov 2013 00:14:30 +0000
Chris Kings-Lynne <Chris.Kings-Lynne AT navitas.com> wrote:

Are there any plans to add host and port CLI options to bsqldb? It's
a severe pain having to use service definitions :(
Hmm? Why is it more difficult to specify hostname & port once in
freetds.conf than it is to specify every time on the command line?

A little-known feature: if the argument to -S is not found in freetds.conf,
it is passed to DNS for resolution. On my system,

$ grep willow ~/.freetds.conf
$ TDSDUMPCONFIG=stdout bsqldb -S willow \ < /dev/null | sed -ne '/willow/p;
/Final/,/port/p'
config.c:170:Getting connection information for [willow].
config.c:468:Looking for section willow.
config.c:288:[willow] not found.
config.c:468:Looking for section willow.
config.c:288:[willow] not found.
config.c:1060:Looking for server willow....
config.c:195:Failed to find [willow] in configuration files; trying 'SYBASE'
instead.
config.c:209:Final connection parameters:
config.c:210: server_name = willow
config.c:211: server_host_name = willow
config.c:212: ip_addr = 192.168.5.17
config.c:213: instance_name = MSSQLSERVER
config.c:214: port = 1433
bsqldb: Msg 20009, Level 9 (OS error 61: Connection refused)Unable to
connect: Adaptive Server is unavailable or does not exist

You can control the port with TDSPORT. Or, you know, it's open source.

--jkl

-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of James K.
Lowden Sent: Saturday, 16 November 2013 11:13 PM To:
freetds AT lists.ibiblio.org Subject: Re: [freetds] Executing a huge sql
script

On Wed, 13 Nov 2013 01:19:45 +0000
Chris Kings-Lynne <Chris.Kings-Lynne AT navitas.com> wrote:

I'm trying to execute a huge sql script via tsql and although it can
execute from management studio, tsql just fails halfway though.
There's no error, nothing. It just finishes its 10th set of 1000
inserts (with GO between) and simply chooses not to continue on with
the next lot, in the same file.
I don't recommend tsql for that purpose; that's not its intended use.
tsql is primarily a diagnostic tool for testing the tds library
independent of the client libraries. That's why it has a bunch of
weird options for bypassing the configuration files, for instance.

I can't think of a reason offhand it would fail, though.

I recommend bsqldb for non-interactive use. The 'b' stands for
"batch". bsqldb will definitely report any errors and messages from
the server, and will exit if a server message carries a serverity >
10.

If that doesn't solve your issue, you'll need a TDSDUMP log.

HTH.

--jkl
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
--
Message protected by MailGuard: e-mail anti-virus, anti-spam and
content filtering.http://www.mailguard.com.au/mg Click here to report
this message as spam:
https://login.mailguard.com.au/report/1IopsmRIQy/1JMb0Wu5nPtoxNKJAt9tR
/0


_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds

_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds





Archive powered by MHonArc 2.6.24.

Top of Page