When using odbc_connect, you don't use the DSN you've previously created.
You use the complete definition of the connection. Here's an example of
connecting to an MS Access database:

        define('ODBC_CONNECT',
                        'DRIVER={Microsoft Access Driver (*.mdb)};
DBQ=\\\\server\\access\\subtable_usa.mdb');
        ...
        $db_access = odbc_connect(ODBC_CONNECT, "", "")
                        or exit;

The part between the braces is the same as what you would select when
defining a DSN.

Regards,

Jerry Schwartz
The Infoshop by Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341

www.the-infoshop.com
www.giiexpress.com
www.etudes-marche.com

>-----Original Message-----
>From: Padiyath Sreekumaran [mailto:[EMAIL PROTECTED]
>Sent: Thursday, April 24, 2008 5:56 AM
>To: mysql@lists.mysql.com
>Subject: Php-mssql connection problems on Windows XP
>
>
>Hello,
>I can connect to a SQL server in the following way from my windows OS
>machine:
>Start --> control Panel -->  Administrative tools ---> Data
>Sources(ODBC)
>and provide the necessary input. This works for me without problems.
>
>I have installed xamp sw on this window machine. The SW version is
>xampfile-win32.1.6.6a.This includes Apache, MySql and PHP SW.
>How can I connect to the SQL server with a php script?I want to use
>the same machine + database as I did in the above case.I have started
>Apache + Mysql from xamp.The in Internet explorere I gave the following
>Command: http://localhost/scrpt.php
>
>I tried the follwong script from(script.php) :
>
><?php
>$dsn="asi_qms";
>$username="asi_qms_2006";
>$password="something";
>$server="xxx";
>if(!$handle = odbc_connect($dsn, '$username', '$password')) die('Keine
>Verbindung möglich!');
>?>
>
>I got the following error when I execute the previous script:
>
>Warning: odbc_connect() [function.odbc-connect]: SQL error:
>[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
>'$username'., SQL state 28000 in SQLConnect in
>C:\xampplite\htdocs\script.php on line 6
>Keine Verbindung möglich!
>
>What is Iam missing? Any help is appreciated.
>Please send a copy of the answer in my personal E-mail address also.
>
>Thanks in advance.
>
>Regards,
>Kumar
>
> ------------------------------------------------------------------
>Padiyath Sreekumar       |   Tel: +41.56.310.3643
>Paul Scherrer Institut   |   email: [EMAIL PROTECTED]
>AIT                      |   Office: WHGA/U132
>WHGA/U132                |   Fax: +41.56.310.3649
>CH-5232 Villigen PSI     |
>Switzerland              |
>-----------------------------------------------------------------
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>infoshop.com





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to