473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

Aug 30 '06 #1
9 5814
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.
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ĝ
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Aug 30 '06 #2
Kim André Akerĝ 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.


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.
js*******@attglobal.net
==================
Aug 30 '06 #3
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.

Aug 30 '06 #4
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

Aug 31 '06 #5
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.
Aug 31 '06 #6

Advo wrote:
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.

Aug 31 '06 #7
Advo wrote:
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.
js*******@attglobal.net
==================
Aug 31 '06 #8

Jerry Stuckle wrote:
Advo wrote:
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.
js*******@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?

Aug 31 '06 #9
Advo wrote:
Jerry Stuckle wrote:
>>Advo wrote:
>>>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.
js*******@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.
js*******@attglobal.net
==================
Aug 31 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Manuel | last post by:
Hello, I try to export a mssql database into a csv-file. I tried this with asp, but it doesn't work. <% Dim objConn Dim csv_path
10
by: ej1008 | last post by:
HI all I am having a windows Control running on ASP.Net webform. From this windows control I am trying to connect to database to do some database operations. Now I am facing problem while...
0
by: Rookie Card | last post by:
Issue - Reformating the Dates in ASP.NET from a MSSQL Database that has <NULL> values in a SmallDateTime Field to read "Dec 8, 2000" instead of "12/8/2000 12:00:00 AM" (As you might already...
0
by: Nicolas | last post by:
please how to synchronise mssql database from db2/400 ? I whish I have my db2/400 database as master and replicate it in an mssql server 2005 for reading thanks Nicolas
3
bhing
by: bhing | last post by:
Ciao!!.. I am currently working with mysql database now and i am trying to get some fields in the mssql database.table.. I want to automatically add those fields to my mysql database table, or if...
7
by: ScottieFromNM | last post by:
I am trying to post values into a mssql database and having some trouble. I create a detail_id in the first query and want to pass this detail_id to several other queries to insert into several other...
1
kwaxy
by: kwaxy | last post by:
Hey Frendz, I can upload files into MS Access database, but unable to upload files to MSSQL database using ASP, can anyone help me plz ????
0
by: anjali123 | last post by:
Hi, I want to prepare crystal reports for my project. I am using the database that is inbuilt with the visual studio (MSSql Database file). I didnt know what to choose as datasource to create a...
1
by: suhad | last post by:
I develop ASP.NET website using VWD and SQLserver 2005 when I try to deploy my web site I dont know the connection string information of the server (database name ,username ,password,server name)and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.