Thread: SQL Connection issues

  1. #1
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    University of Waterloo

    SQL Connection issues

    I'm having issues connecting to an sql server and was wondering if anybody knew anything about it.

    I was told to connect to the server on a certain port, so here is what I did in php:

    PHP Code:



    Now, for some reason, when I run this code, nothing gets outputted, the page just sits there for about 30 seconds, and then just says "Done" at the bottom. I'm guessing that it is timing out or something, and that for some reason if the mysql_connect command times out, my whole script just stops running.

    I think the problem could be arising from the fact that I'm using mysql to connect to a SQL2000 database, but I don't know enough about the two and have never connected to databases that weren't on my website before.

    Any help would be appreciated, thanks.

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Ontario, Canada
    You will only be able to connect to the db with a SQL2000 API. MySQL won't work.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    University of Waterloo
    $hit...then how do I go about connecting to it? I need to be able to do this for a job and it needs to be done for tomorrow or I won't get payed

    hmm, I guess this is more of a question I need to aim at my host.

  4. #4
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    You're trying to connect to a Microsoft SQL server using MySQL functions. That's like calling your local library and speaking chinese (unless you live in China).

    You'll want to use something like this:
    PHP Code:
    mssql_connect ($sql_server$user_server$password_server
    Note mssql_connect as opposed to mysql_connect.
    Last edited by nickname_changed; 02-16-2005 at 10:06 PM.

  5. #5
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Echo stovellp on this one. And make sure your host has enabled support for the library (in the php.ini file). Not many hosts set this up for you unless they're hosting the SQL2000 server.

    I would also assume that you are correct in the way you tried to use the port, however that might be a setting elsewhere.

    If you need more help, I work with PHP and an SQL2000 server every day (although on the default port).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sql connection problem
    By arian in forum C# Programming
    Replies: 0
    Last Post: 08-15-2008, 12:43 PM
  2. Embedded SQL
    By sarac in forum C Programming
    Replies: 1
    Last Post: 05-04-2006, 09:09 AM
  3. Replies: 0
    Last Post: 03-23-2006, 12:42 PM
  4. Replies: 1
    Last Post: 03-21-2006, 07:52 AM
  5. Headers that use each other
    By nickname_changed in forum C++ Programming
    Replies: 7
    Last Post: 10-03-2003, 04:25 AM