Hosting an app on a different server and connecting to DiscountASP's MSSQL

Discussion in 'HTML / PHP / JavaScript / CSS' started by OskarK, Feb 15, 2007.

  1. Is it possible to connect to DiscountASP's MSSQL db when the script is located on a different server?

    I am using this to connect:

    $ConnString="DRIVER={SQL Server};SERVER=tcp:mssql01.discountasp.net;DATABASE=********";

    It is running fine while local and the error I am getting is this:


    Warning: odbc_connect(): SQL error: [Microsoft][ODBC SQL Server Driver]Client unable to establish connection, SQL state 08001 in SQLConnect
     
  2. I do it all the time from ASP and ASP.NET...What scripting language/page are you using?
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    this most likely means that the server/network hosting the application blocks 1433 port.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  4. Here is a little update. I managed to connect to the database on DISCOUNT ASP from our serverruning php (4.3.8)using odbc_connect()


    this is the error message that I am getting:



    Warning: odbc_exec(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]EXECUTE permission denied on object 'sp_cursoropen', database 'master', owner 'dbo'., SQL state 42000 in SQLExecDirect in xxxxxxxxxxxxxxxxxxxxxxxxxxxxx on line 14







    Here is how I connect:


    $conn=odbc_connect('SYSTEM_DSN_NAME','username','password');
    if (!$conn)
    {exit("Connection Failed: " . $conn);}
    $sql="SELECT id, firstname, lastname FROM dbo.tablename";
    $Result=odbc_exec($conn,$sql);


    System DSM is actually using the root account to login.


    What am I missing?


    Thanks,
     
  5. Bruce

    Bruce DiscountASP.NET Staff

    looks like your application is trying to access the master database which is not permitted.

    check your DSN setting to make sure you point the default database to your database.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  6. It is that's part of the problem.

    The default database is set to our.
     
  7. Bruce

    Bruce DiscountASP.NET Staff

    well.. not according to the error. The error says you are trying to do something in the master db.

    Try change your query to

    SELECT id, firstname, lastname FROM [yourdatabaseName].dbo.tablename

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     

Share This Page