php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49545 PHP, IIS, MYSQL
Submitted: 2009-09-13 18:51 UTC Modified: 2009-09-22 01:00 UTC
From: gezine at hotmail dot com Assigned:
Status: No Feedback Package: ODBC related
PHP Version: 5.3.0 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
38 - 27 = ?
Subscribe to this entry?

 
 [2009-09-13 18:51 UTC] gezine at hotmail dot com
Description:
------------
Locally on my computer my connection to the database works fine but the moment I upload my file to the web server, and submit a form I receive the error. 

Webserver Information
-----------------------
Operating System: Windows 
PHP Version: PHP 5.x IIS 
Version: IIS 7.0  

code tried but no luck
----------------------
http://us3.php.net/manual/en/function.odbc-connect.php

Reproduce code:
---------------
function connect_to_database($dsn, $user, $password)
{
//create a connection to the database
$conn = odbc_connect($dsn, $user, password,SQL_CUR_USE_DRIVER);
    
   //if the connection failed display the appropriate message
    if(!$conn)
    {
      output_error();
      die();
    }//end if(_);
    else
    { 

     //return connection has been established.
     return $conn;
    }//end else

}//end connect_to_database(_);




Expected result:
----------------
I expected a successful return since every thing on the webserver(Godaddy) is setup correctly according to their test.

Actual result:
--------------
"Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in "


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-14 07:06 UTC] kalle@php.net
Unless that specified driver isnt installed on the client machine for ODBC to use, then it will fail. You need the MySQL Connector thru ODBC to make use of the ODBC functions for talking to mysql via ODBC.
 [2009-09-14 18:12 UTC] gezine at hotmail dot com
Kalle,

Thank you for taking the time to write a response.

WebServer Solution
------------------
//where $path = C:/a_path/on/my_web_server/my_db_folder/

$path = $_SERVER["DOCUMENT_ROOT"]) . "\\db\\database.mdb";

$dbq  =  str_replace("/", "\\", $path );

if(!file_exists($dbq)) 
{ 
 output_error();
 die(); 
}
else
{

 $conn = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};
                     Dbq=$dbq;", 'test', '1234');
 if(!$conn)
 {
  output_error();
  die(); }//end if(_);
 }
 else
 {
  //SQL Command

  //sends sql command to the server
  $rs = odbc_exec($conn,$sql);

 }//end else

 //closes the connection to the database
 odbc_close($conn);

}//end else


Question
--------
After trying it in my webserver with the domain name along with the correct directory this doesn't work.

1. Is this a permission issue itself on the folder/file since it works now with the correct path not with my.domainname.com/html_path/my_database_folder/ or something else?

2. Any documents you have on this would be of great importance to me.

3. Is this actually a driver issue since it works now?

4. I will try your advice and post my result.
 [2009-09-22 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 04:01:27 2024 UTC