php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13312 cant connect to a odbc source
Submitted: 2001-09-15 04:04 UTC Modified: 2001-09-16 08:51 UTC
From: parabips at hotmail dot com Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0.6 OS: Windows2000 server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: parabips at hotmail dot com
New email:
PHP Version: OS:

 

 [2001-09-15 04:04 UTC] parabips at hotmail dot com
I tried to connect with a Microsoft Access database but it didnt work.

I made the DSN named reg and then I used the following code to connect

$connection=odbc_connect("reg","admin","") or die ("Cant connect the
datasource");
$sql="Select * from newuser order by name asc";
$sql_statement=odbc_prepare($connection,$sql) or die ("Cant prepare statement");
$sql_result=odbc_execute($sql_statement) or die ("Cant execute query");
odbc_result_all($sql_result,"border=1");
odbc_free-result($sql_result);
odbc_close($connection);

when i view the php page it says

Warning: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found
and no default driver specified

can anyone solve my problem

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-09-15 14:19 UTC] ahill@php.net
This will occur on Windows if you try to use a File DSN 
instead of a System DSN - and is expected behavior.  Try a 
System DSN.

For people searching the bug list, if you experience this 
on linux/unix, this will occur if you don't pass the 
location of your odbc.ini to your script with a 
putenv("ODBCINI=/path/to/odbc.ini");

Best regards,
Andrew Hill
OpenLink Software
 [2002-09-14 19:30 UTC] shuklasanjeev at yahoo dot com
I recently installed php4.2.3 on windows 2000 Advance server SP2.
When I tried to execute the following script:
===========
<?php 
    $conn = odbc_connect('tlgdevpnr','tlguser','tlguser123');
?>
===========
I received following error:
===========
Warning: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in D:\wwwcode\php_codes\odbc_test.php on line 2
===========
The DSN "tlgdevpnr" is System DSN and I am using it with ASP,ColdFusion and other Applications.

Please let me know if you have any clue.

Thanks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 05:01:27 2025 UTC