connecting to a mssql database | | |
Im having major problems trying to connect to a mssql database thats
hosted on our server.
I've got the ip, username, password and database name, yet no matter
what i try, I cant seem to connect. I've trawled the net for hours
looking for code, has anyone got any that definately works, or just a
simple way I can check the connection.
Thanks | | | | re: connecting to a mssql database
Advo wrote: Quote:
Im having major problems trying to connect to a mssql database thats
hosted on our server.
>
I've got the ip, username, password and database name, yet no matter
what i try, I cant seem to connect. I've trawled the net for hours
looking for code, has anyone got any that definately works, or just a
simple way I can check the connection.
I don't know how you've tried it, but you should be doing something
like this in your code:
mysql_connect($ip, $username, $password);
mysql_select_db($database);
You should also be doing this on the server, and not directly from
home. Security settings on the database server will only allow
connections from a certain IP (or IP range).
--
Kim André Akerĝ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly) | | | | re: connecting to a mssql database
Kim André Akerĝ wrote: Quote:
Advo wrote:
>
> Quote:
>>Im having major problems trying to connect to a mssql database thats
>>hosted on our server.
>>
>>I've got the ip, username, password and database name, yet no matter
>>what i try, I cant seem to connect. I've trawled the net for hours
>>looking for code, has anyone got any that definately works, or just a
>>simple way I can check the connection.
>
>
I don't know how you've tried it, but you should be doing something
like this in your code:
>
mysql_connect($ip, $username, $password);
mysql_select_db($database);
>
You should also be doing this on the server, and not directly from
home. Security settings on the database server will only allow
connections from a certain IP (or IP range).
>
Except he's using MS SQL Server, not MySQL. But the statements are the
same - just substitute 'mssql' for 'mysql'.
It's hard to say without knowing what error messages you get. Did you
check the user notes for mssql_connect at http://www.php.net/manual/en/functio...l-connect.php? They contain
some good information.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attglobal.net
================== | | | | re: connecting to a mssql database
Advo wrote: Quote:
Im having major problems trying to connect to a mssql database thats
hosted on our server.
>
I've got the ip, username, password and database name, yet no matter
what i try, I cant seem to connect. I've trawled the net for hours
looking for code, has anyone got any that definately works, or just a
simple way I can check the connection.
>
>
Thanks
What platform is PHP running on? What version of PHP? What API are you
using? Are you using integrated security? What version of SQL Server?
Without more information no one will be able to help you. | | | | re: connecting to a mssql database
Heres some actual code i've tried:
<?php
echo "here";
$cs = mssql_connect ( 'ip...', 'administrator', 'pass' ) or die('Could
not connect: ' . mssql_get_last_message());
echo "here2";
then i run my page, and all it says is "here"
nothing else | | | | re: connecting to a mssql database
php etc is installed on our hosting, so not sure about that, i could
possibly look into it if needs be. I just develop the php files, and
then upload to our fasthosts dedicated server.. but we are running
Microsoft SQL Server 2000 on our server..
Chung Leong wrote: Quote:
Advo wrote: Quote:
Im having major problems trying to connect to a mssql database thats
hosted on our server.
I've got the ip, username, password and database name, yet no matter
what i try, I cant seem to connect. I've trawled the net for hours
looking for code, has anyone got any that definately works, or just a
simple way I can check the connection.
Thanks
>
What platform is PHP running on? What version of PHP? What API are you
using? Are you using integrated security? What version of SQL Server?
Without more information no one will be able to help you.
| | | | re: connecting to a mssql database
Advo wrote: Quote:
Heres some actual code i've tried:
>
<?php
echo "here";
$cs = mssql_connect ( 'ip...', 'administrator', 'pass' ) or die('Could
not connect: ' . mssql_get_last_message());
echo "here2";
>
>
>
then i run my page, and all it says is "here"
>
nothing else
Looks like the mssql extension wasn't turned on. Your script is dying
with a undefined function error. | | | | re: connecting to a mssql database
Advo wrote: Quote:
php etc is installed on our hosting, so not sure about that, i could
possibly look into it if needs be. I just develop the php files, and
then upload to our fasthosts dedicated server.. but we are running
Microsoft SQL Server 2000 on our server..
>
>
Chung Leong wrote:
>
> Quote:
>>Advo wrote:
>> Quote:
>>>Im having major problems trying to connect to a mssql database thats
>>>hosted on our server.
>>>
>>>I've got the ip, username, password and database name, yet no matter
>>>what i try, I cant seem to connect. I've trawled the net for hours
>>>looking for code, has anyone got any that definately works, or just a
>>>simple way I can check the connection.
>>>
>>>
>>>Thanks
>>
>>What platform is PHP running on? What version of PHP? What API are you
>>using? Are you using integrated security? What version of SQL Server?
>>Without more information no one will be able to help you.
>
>
Turn on all errors and display them to see what you're getting:
ini_set('display_errors', '1');
error_reporting(E_ALL);
And phpinfo() will tell you if the mssql extensions are loaded in PHP.
Just having SQL Server on the system isn't enough. You also have to
enable it in php.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attglobal.net
================== | | | | re: connecting to a mssql database
Jerry Stuckle wrote: Quote:
Advo wrote: Quote:
php etc is installed on our hosting, so not sure about that, i could
possibly look into it if needs be. I just develop the php files, and
then upload to our fasthosts dedicated server.. but we are running
Microsoft SQL Server 2000 on our server..
Chung Leong wrote: Quote:
>Advo wrote:
>
>>Im having major problems trying to connect to a mssql database thats
>>hosted on our server.
>>
>>I've got the ip, username, password and database name, yet no matter
>>what i try, I cant seem to connect. I've trawled the net for hours
>>looking for code, has anyone got any that definately works, or just a
>>simple way I can check the connection.
>>
>>
>>Thanks
>
>What platform is PHP running on? What version of PHP? What API are you
>using? Are you using integrated security? What version of SQL Server?
>Without more information no one will be able to help you.
>
Turn on all errors and display them to see what you're getting:
>
ini_set('display_errors', '1');
error_reporting(E_ALL);
>
And phpinfo() will tell you if the mssql extensions are loaded in PHP.
>
Just having SQL Server on the system isn't enough. You also have to
enable it in php.
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attglobal.net
==================
yea i think thats the problem because ive got this now, with errors
turned on:
start
Fatal error: Call to undefined function mssql_connect() in
/home/default/site/user/htdocs/testmssql.php on line 5
so basically i need to do extension=php_mssql.dll in my php.ini? | | | | re: connecting to a mssql database
Advo wrote: Quote:
Jerry Stuckle wrote:
> Quote:
>>Advo wrote:
>> Quote:
>>>php etc is installed on our hosting, so not sure about that, i could
>>>possibly look into it if needs be. I just develop the php files, and
>>>then upload to our fasthosts dedicated server.. but we are running
>>>Microsoft SQL Server 2000 on our server..
>>>
>>>
>>>Chung Leong wrote:
>>>
>>>
>>>
>>>>Advo wrote:
>>>>
>>>>
>>>>>Im having major problems trying to connect to a mssql database thats
>>>>>hosted on our server.
>>>>>
>>>>>I've got the ip, username, password and database name, yet no matter
>>>>>what i try, I cant seem to connect. I've trawled the net for hours
>>>>>looking for code, has anyone got any that definately works, or just a
>>>>>simple way I can check the connection.
>>>>>
>>>>>
>>>>>Thanks
>>>>
>>>>What platform is PHP running on? What version of PHP? What API are you
>>>>using? Are you using integrated security? What version of SQL Server?
>>>>Without more information no one will be able to help you.
>>>
>>>
>>Turn on all errors and display them to see what you're getting:
>>
>>ini_set('display_errors', '1');
>>error_reporting(E_ALL);
>>
>>And phpinfo() will tell you if the mssql extensions are loaded in PHP.
>>
>>Just having SQL Server on the system isn't enough. You also have to
>>enable it in php.
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>jstucklex@attglobal.net
>>==================
>
>
>
>
>
yea i think thats the problem because ive got this now, with errors
turned on:
>
start
Fatal error: Call to undefined function mssql_connect() in
/home/default/site/user/htdocs/testmssql.php on line 5
>
>
>
so basically i need to do extension=php_mssql.dll in my php.ini?
>
Yes, if everything else is set up correctly that should do it.
It's also a good idea to check the settings in the [MSSQL] section of
your php.ini.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attglobal.net
================== |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,392 network members.
|