Discussion:
[freetds] Executing a huge sql script
Chris Kings-Lynne
2013-11-13 01:19:45 UTC
Permalink
Hi Guys,

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.

Is this something worth looking into? I could replace all the literal strings in my file with garbage for testing? The sql file is about 10MB or so.

Chris
Frediano Ziglio
2013-11-13 07:25:33 UTC
Permalink
How many characters are the 10000 inserts? How do you pass the query? Tsql? Perhaps prepared statements have limits while standard (like SQLExecDirect) I doubt.

Frediano Ziglio
Post by Chris Kings-Lynne
Hi Guys,
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.
Is this something worth looking into? I could replace all the literal strings in my file with garbage for testing? The sql file is about 10MB or so.
Chris
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
Merle Reinhart
2013-11-13 19:07:41 UTC
Permalink
Does it work when executed with fisql?

Merle
Date: Wed, 13 Nov 2013 01:19:45 +0000
From: Chris Kings-Lynne <Chris.Kings-Lynne at navitas.com>
Subject: [freetds] Executing a huge sql script
To: FreeTDS Development Group <freetds at lists.ibiblio.org>
<a63bc55c022740bfad10d1fbc014fbb6 at HKXPR02MB007.apcprd02.prod.outlook.com>
Content-Type: text/plain; charset="us-ascii"
Hi Guys,
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.
Is this something worth looking into? I could replace all the literal strings in my file with garbage for testing? The sql file is about 10MB or so.
Chris
Chris Kings-Lynne
2013-11-14 02:25:49 UTC
Permalink
Hmm now I look silly. I didn't even know those utilities existed :/

I tried running it with bsqldb and fisql...but found that it doesn't support hostname/port connections - only service?

Chris


-----Original Message-----
From: freetds-bounces at lists.ibiblio.org [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Merle Reinhart
Sent: Thursday, 14 November 2013 3:08 AM
To: freetds at lists.ibiblio.org
Subject: Re: [freetds] Executing a huge sql script

Does it work when executed with fisql?

Merle
Date: Wed, 13 Nov 2013 01:19:45 +0000
From: Chris Kings-Lynne <Chris.Kings-Lynne at navitas.com>
Subject: [freetds] Executing a huge sql script
To: FreeTDS Development Group <freetds at lists.ibiblio.org>
<a63bc55c022740bfad10d1fbc014fbb6 at HKXPR02MB007.apcprd02.prod.outlook.com>
Content-Type: text/plain; charset="us-ascii"
Hi Guys,
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.
Is this something worth looking into? I could replace all the literal strings in my file with garbage for testing? The sql file is about 10MB or so.
Chris
_______________________________________________
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/1InfwajmpY/6ikj4juU1rfHi2rhnOVWlU/1.747
James K. Lowden
2013-11-16 15:13:10 UTC
Permalink
On Wed, 13 Nov 2013 01:19:45 +0000
Post by Chris Kings-Lynne
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
Chris Kings-Lynne
2013-11-17 00:14:30 UTC
Permalink
Are there any plans to add host and port CLI options to bsqldb? It's a severe pain having to use service definitions :(

Chris

-----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
Post by Chris Kings-Lynne
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
Konrad Hambrick
2013-11-17 12:28:58 UTC
Permalink
Chris --

Have you looked at sqsh ?

http://sourceforge.net/projects/sqsh/files/

-- kjh
Post by Chris Kings-Lynne
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org [mailto:freetds-bounces at lists.ibiblio.org] On
Behalf Of Chris Kings-Lynne
Sent: Saturday, November 16, 2013 6:15 PM
To: FreeTDS Development Group
Subject: Re: [freetds] Executing a huge sql script
Are there any plans to add host and port CLI options to bsqldb? It's a severe pain having
to use service definitions :(
Chris
-----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
Post by Chris Kings-Lynne
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
https://login.mailguard.com.au/report/1IopsmRIQy/1JMb0Wu5nPtoxNKJAt9tR/0
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
James K. Lowden
2013-11-18 05:18:15 UTC
Permalink
On Sun, 17 Nov 2013 00:14:30 +0000
Post by Chris Kings-Lynne
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
Post by Chris Kings-Lynne
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of James K.
freetds at lists.ibiblio.org Subject: Re: [freetds] Executing a huge sql
script
On Wed, 13 Nov 2013 01:19:45 +0000
Post by Chris Kings-Lynne
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
https://login.mailguard.com.au/report/1IopsmRIQy/1JMb0Wu5nPtoxNKJAt9tR/0
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
Chris Kings-Lynne
2013-11-19 00:41:00 UTC
Permalink
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
Post by Chris Kings-Lynne
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
Post by Chris Kings-Lynne
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of James K.
freetds at lists.ibiblio.org Subject: Re: [freetds] Executing a huge sql
script
On Wed, 13 Nov 2013 01:19:45 +0000
Post by Chris Kings-Lynne
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
https://login.mailguard.com.au/report/1IopsmRIQy/1JMb0Wu5nPtoxNKJAt9tR
/0
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
David Chang
2013-11-19 01:30:41 UTC
Permalink
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
Post by Chris Kings-Lynne
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
Post by Chris Kings-Lynne
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: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
Post by Chris Kings-Lynne
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of James K.
freetds at lists.ibiblio.org Subject: Re: [freetds] Executing a huge sql
script
On Wed, 13 Nov 2013 01:19:45 +0000
Post by Chris Kings-Lynne
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
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
Konrad Hambrick
2013-11-19 17:30:07 UTC
Permalink
Not to mention that each Developer can have a distinct $HOME/.freetds.conf file ...

-- kjh
Post by Chris Kings-Lynne
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org [mailto:freetds-bounces at lists.ibiblio.org] On
Behalf Of David Chang
Sent: Monday, November 18, 2013 7:31 PM
To: freetds at lists.ibiblio.org
Subject: Re: [freetds] Executing a huge sql script
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_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
Post by Chris Kings-Lynne
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.
Post by Chris Kings-Lynne
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 :(
Post by Chris Kings-Lynne
Chris
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org [mailto:freetds-bounces at lists.ibiblio.org] On
Behalf Of James K. Lowden
Post by Chris Kings-Lynne
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
Post by Chris Kings-Lynne
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?
Post by Chris Kings-Lynne
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,
Post by Chris Kings-Lynne
$ grep willow ~/.freetds.conf
$ TDSDUMPCONFIG=stdout bsqldb -S willow \ < /dev/null | sed -ne '/willow/p;
/Final/,/port/p'
Post by Chris Kings-Lynne
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: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
Post by Chris Kings-Lynne
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of James K.
freetds at lists.ibiblio.org Subject: Re: [freetds] Executing a huge sql
script
On Wed, 13 Nov 2013 01:19:45 +0000
Post by Chris Kings-Lynne
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
Chris Kings-Lynne
2013-11-20 02:37:58 UTC
Permalink
I don't think you understand what Vagrant is Konrad...

Anyway, I'll patch it soon as I have time

-----Original Message-----
From: freetds-bounces at lists.ibiblio.org [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Konrad Hambrick
Sent: Wednesday, 20 November 2013 1:30 AM
To: 'freetds at lists.ibiblio.org'
Subject: Re: [freetds] Executing a huge sql script



Not to mention that each Developer can have a distinct $HOME/.freetds.conf file ...

-- kjh
Post by Chris Kings-Lynne
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of David Chang
Sent: Monday, November 18, 2013 7:31 PM
To: freetds at lists.ibiblio.org
Subject: Re: [freetds] Executing a huge sql script
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_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
Post by Chris Kings-Lynne
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.
Post by Chris Kings-Lynne
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 :(
Post by Chris Kings-Lynne
Chris
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On
Behalf Of James K. Lowden
Post by Chris Kings-Lynne
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
Post by Chris Kings-Lynne
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?
Post by Chris Kings-Lynne
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,
Post by Chris Kings-Lynne
$ grep willow ~/.freetds.conf
$ TDSDUMPCONFIG=stdout bsqldb -S willow \ < /dev/null | sed -ne '/willow/p;
/Final/,/port/p'
Post by Chris Kings-Lynne
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: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
Post by Chris Kings-Lynne
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of James K.
freetds at lists.ibiblio.org Subject: Re: [freetds] Executing a huge
sql script
On Wed, 13 Nov 2013 01:19:45 +0000
Post by Chris Kings-Lynne
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/1IpFQgcTnJ/7k4ybtrYLjM2WxkYLlCKBr/0
Frediano Ziglio
2013-11-20 08:46:23 UTC
Permalink
Hi Chris,
did you read documentation? Probably what you are looking for is
http://www.freetds.org/userguide/name.lookup.htm and
http://www.freetds.org/userguide/portoverride.htm. Combined allow you
to use something like "localhost:1111" as your server name. For the
protocol version you have still to use default setting (probably if
you have only mssql 7.2 is not safe unless you have still some 2000).

As James noted our applications are mainly meant as test applications
or small scripts. For instance is quite hard to detect an error with
huge inserts like what you are trying to do. Probably tsql sent all
the query to the server but for some intermediate errors server did
not execute all your queries.

Frediano
Post by Chris Kings-Lynne
I don't think you understand what Vagrant is Konrad...
Anyway, I'll patch it soon as I have time
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Konrad Hambrick
Sent: Wednesday, 20 November 2013 1:30 AM
To: 'freetds at lists.ibiblio.org'
Subject: Re: [freetds] Executing a huge sql script
Not to mention that each Developer can have a distinct $HOME/.freetds.conf file ...
-- kjh
Post by Chris Kings-Lynne
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of David Chang
Sent: Monday, November 18, 2013 7:31 PM
To: freetds at lists.ibiblio.org
Subject: Re: [freetds] Executing a huge sql script
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_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
Post by Chris Kings-Lynne
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.
Post by Chris Kings-Lynne
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 :(
Post by Chris Kings-Lynne
Chris
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On
Behalf Of James K. Lowden
Post by Chris Kings-Lynne
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
Post by Chris Kings-Lynne
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?
Post by Chris Kings-Lynne
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,
Post by Chris Kings-Lynne
$ grep willow ~/.freetds.conf
$ TDSDUMPCONFIG=stdout bsqldb -S willow \ < /dev/null | sed -ne '/willow/p;
/Final/,/port/p'
Post by Chris Kings-Lynne
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: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
Post by Chris Kings-Lynne
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of James K.
freetds at lists.ibiblio.org Subject: Re: [freetds] Executing a huge
sql script
On Wed, 13 Nov 2013 01:19:45 +0000
Post by Chris Kings-Lynne
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
https://login.mailguard.com.au/report/1IpFQgcTnJ/7k4ybtrYLjM2WxkYLlCKBr/0
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
Konrad Hambrick
2013-11-27 11:31:00 UTC
Permalink
Post by Chris Kings-Lynne
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org [mailto:freetds-bounces at lists.ibiblio.org] On
Behalf Of Chris Kings-Lynne
Sent: Tuesday, November 19, 2013 8:38 PM
To: FreeTDS Development Group
Subject: Re: [freetds] Executing a huge sql script
I don't think you understand what Vagrant is Konrad...
Anyway, I'll patch it soon as I have time
Chris --

How'd you guess <G> ?

I did look up Vagrant -- looks interesting.

It does appear that there's a default login ( vagrant ).

Could you add a default $HOME/vagrant/.freetds.conf file before building your
Distrib and then let your Devs edit their ~/.freetds.conf file as needed ?

-- kjh
Chris Kings-Lynne
2013-11-28 00:08:15 UTC
Permalink
Actually what Frediano said solved it for me - that you can put host:port in place of the service name and it works. Seems it works from within the PHP driver too. Changed my life :)

Yes, bsqldb can process the huge sql script just fine, and now all our lovely continuous deployment scripts have been updated.

In other, very annoying news though, the Zend Framework 2.2 people for PHP have decided that they're not supporting FreeTDS :(

https://github.com/zendframework/zf2/pull/5092

Only Microsoft's driver :(

Chris

-----Original Message-----
From: freetds-bounces at lists.ibiblio.org [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Konrad Hambrick
Sent: Wednesday, 27 November 2013 7:31 PM
To: 'FreeTDS Development Group'
Subject: Re: [freetds] Executing a huge sql script
Post by Chris Kings-Lynne
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Chris
Kings-Lynne
Sent: Tuesday, November 19, 2013 8:38 PM
To: FreeTDS Development Group
Subject: Re: [freetds] Executing a huge sql script
I don't think you understand what Vagrant is Konrad...
Anyway, I'll patch it soon as I have time
Chris --

How'd you guess <G> ?

I did look up Vagrant -- looks interesting.

It does appear that there's a default login ( vagrant ).

Could you add a default $HOME/vagrant/.freetds.conf file before building your Distrib and then let your Devs edit their ~/.freetds.conf file as needed ?

-- kjh

_______________________________________________
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/1IsRLEHgzo/YViTJXtVpOWCNc5WO0nI6/0
James K. Lowden
2013-11-28 01:42:09 UTC
Permalink
On Thu, 28 Nov 2013 00:08:15 +0000
Post by Chris Kings-Lynne
In other, very annoying news though, the Zend Framework 2.2 people
for PHP have decided that they're not supporting FreeTDS :(
https://github.com/zendframework/zf2/pull/5092
Only Microsoft's driver :(
FWIW, I didn't see anything on that page to that effect, and a quick
glance through their User Guide didn't turn up an obvious list of what
DBMS client libraries they support.

But if that's what works for them, of course that's what they should
do.

--jkl

Chris Kings-Lynne
2013-11-28 00:15:41 UTC
Permalink
Let me know if I shouldn't be spamming the list with this chat, but...

The whole point of Vagrant is that at any time you 'vagrant destroy' and then 'vagrant up' to rebuild the environment. So any per-user hackery that needs to live within the VM is painful.

Cheers,

Chris
Post by Chris Kings-Lynne
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Chris
Kings-Lynne
Sent: Tuesday, November 19, 2013 8:38 PM
To: FreeTDS Development Group
Subject: Re: [freetds] Executing a huge sql script
I don't think you understand what Vagrant is Konrad...
Anyway, I'll patch it soon as I have time
Chris --

How'd you guess <G> ?

I did look up Vagrant -- looks interesting.

It does appear that there's a default login ( vagrant ).

Could you add a default $HOME/vagrant/.freetds.conf file before building your Distrib and then let your Devs edit their ~/.freetds.conf file as needed ?

-- kjh

_______________________________________________
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/1IsRLEHgzo/YViTJXtVpOWCNc5WO0nI6/0
Patrick McCoole
2013-11-19 02:21:15 UTC
Permalink
Stop


Patrick McCoole
Post by Chris Kings-Lynne
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
Post by Chris Kings-Lynne
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: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
Post by Chris Kings-Lynne
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of James K.
freetds at lists.ibiblio.org Subject: Re: [freetds] Executing a huge sql
script
On Wed, 13 Nov 2013 01:19:45 +0000
Post by Chris Kings-Lynne
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
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
Continue reading on narkive:
Loading...