Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #2316 > unrolled thread
| Started by | "chris.percol" <chris.percol@gmail.com> |
|---|---|
| First post | 2011-06-23 09:19 -0700 |
| Last post | 2011-06-24 00:56 -0700 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.php
mssql_connect syntax when using port muber "chris.percol" <chris.percol@gmail.com> - 2011-06-23 09:19 -0700
Re: mssql_connect syntax when using port muber "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-06-23 18:36 +0200
Re: mssql_connect syntax when using port muber "chris.percol" <chris.percol@gmail.com> - 2011-06-24 00:56 -0700
| From | "chris.percol" <chris.percol@gmail.com> |
|---|---|
| Date | 2011-06-23 09:19 -0700 |
| Subject | mssql_connect syntax when using port muber |
| Message-ID | <ccfc0ce6-040f-43f0-93fa-5004a4261914@g16g2000yqg.googlegroups.com> |
Hi,
I have a cron job successfully querying a random mssql database from
numerous servers using php cli (5.3.2) in conjunction with openvpn.
Connection strings are in the form of ip\instance. The one case where
the script doesn't work is for mssql instances that are on the other
side of an iptables box and the port number is required.
This same connection string works fine in sql management studio,
'192.168.1.1\instance_name,10000' but not as part of mssql_connection
in my script.
$link = mssql_connect('192.168.1.1\instance_name,10000', user, pass);
Anyone any thoughts as to why this isn't working when including a
port?
Many thanks,
Chris
[toc] | [next] | [standalone]
| From | "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> |
|---|---|
| Date | 2011-06-23 18:36 +0200 |
| Message-ID | <itvq36$d50$1@dont-email.me> |
| In reply to | #2316 |
El 23/06/2011 18:19, chris.percol escribió/wrote:
> I have a cron job successfully querying a random mssql database from
> numerous servers using php cli (5.3.2) in conjunction with openvpn.
>
> Connection strings are in the form of ip\instance. The one case where
> the script doesn't work is for mssql instances that are on the other
> side of an iptables box and the port number is required.
>
> This same connection string works fine in sql management studio,
> '192.168.1.1\instance_name,10000' but not as part of mssql_connection
> in my script.
>
> $link = mssql_connect('192.168.1.1\instance_name,10000', user, pass);
>
> Anyone any thoughts as to why this isn't working when including a
> port?
Some guessing... The PHP manual says that «[the MSSQL] is not available
anymore on Windows with PHP 5.3 or later.» so you must be using Linux:
http://es2.php.net/manual/en/intro.mssql.php
In that case, you are not using the the syntax described in the manual:
resource mssql_connect ([ string $servername [, string $username [,
string $password [, bool $new_link = false ]]]] )
servername
The MS SQL server. It can also include a port number, e.g.
hostname:port (Linux), or hostname,port (Windows).
http://es2.php.net/manual/en/function.mssql-connect.php
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
[toc] | [prev] | [next] | [standalone]
| From | "chris.percol" <chris.percol@gmail.com> |
|---|---|
| Date | 2011-06-24 00:56 -0700 |
| Message-ID | <91af2138-ee4e-49f1-a22f-df16214ec6f4@j15g2000yqf.googlegroups.com> |
| In reply to | #2317 |
On Jun 23, 5:36 pm, "Álvaro G. Vicario"
<alvaro.NOSPAMTH...@demogracia.com.invalid> wrote:
> El 23/06/2011 18:19, chris.percol escribi /wrote:
>
> > I have a cron job successfully querying a random mssql database from
> > numerous servers using php cli (5.3.2) in conjunction with openvpn.
>
> > Connection strings are in the form of ip\instance. The one case where
> > the script doesn't work is for mssql instances that are on the other
> > side of an iptables box and the port number is required.
>
> > This same connection string works fine in sql management studio,
> > '192.168.1.1\instance_name,10000' but not as part of mssql_connection
> > in my script.
>
> > $link = mssql_connect('192.168.1.1\instance_name,10000', user, pass);
>
> > Anyone any thoughts as to why this isn't working when including a
> > port?
>
> Some guessing... The PHP manual says that [the MSSQL] is not available
> anymore on Windows with PHP 5.3 or later. so you must be using Linux:
>
> http://es2.php.net/manual/en/intro.mssql.php
>
> In that case, you are not using the the syntax described in the manual:
>
> resource mssql_connect ([ string $servername [, string $username [,
> string $password [, bool $new_link = false ]]]] )
>
> servername
>
> The MS SQL server. It can also include a port number, e.g.
> hostname:port (Linux), or hostname,port (Windows).
>
> http://es2.php.net/manual/en/function.mssql-connect.php
>
> --
> --http://alvaro.es- lvaro G. Vicario - Burgos, Spain
> -- Mi sitio sobre programaci n web:http://borrame.com
> -- Mi web de humor satinado:http://www.demogracia.com
> --
Álvaro,
Thank you for your detailed answer to my question.
I had looked at mssql_connect examples in the manual but not read the
contents properly, missing hostname: port (Linux).
Thanks again,
Chris
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web