Re: Re: connect to mssql instance using php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Larry.

Makes sense.
We are using different ids and pws, as I showed in my example of  
$user / $pw and $user1 / $pw1 for the 2 instances.
We were thinking that the problem had something to do with how php  
was handling the "\" in the servername, but turns out to be something  
entirely different.

For those interested, seems as though MSSQL Server assigns random  
ports to named instances, and we needed to use the port in the  
servername to access them.
So, the default db servername can be 192.168.1.208, but the named  
instance must be 192.168.1.208:xxxx where xxxx is the port.
According to all examples and documentation, it is not supposed to  
work this way, as you are supposed to be able to simply use the db  
instance name (192.168.1.208/XYZ2005), but it ain't that way on our  
setup.

Thanks for the help!

On Jun 19, 2009, at 12:19 AM, Larry Helms wrote:

>
>
> mysql_connect doesn't work like you think it does. It doesn't 'set'  
> a database for you... it merely connects you to query processor.
>
> YOU control access to databases and tables via user ids &  
> passwords, and grants.
>
> NORMALLY, You should be using different user ids & passwords... to  
> access different databases.
>
> I keep all my connection information in external files that are  
> named according to the db and host that the db is running on... eg:
>
> hostname-dbname.php
> host1-devdb.php
> host2-tstdb.php
> host3-prddb.php
>
> a main include file, then uses the $_SERVER['SERVER_NAME'] to  
> determine the appropriate file, based on which host the script(s)  
> are running on. This insures that you don't have developers doing  
> stuff to the production database... and you don't have cross db  
> security issues.
>
> I hope all that makes sense.
>
> _


[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux