vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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: kumar.padiyath@psi.ch AIT | Office: WHGA/U132 WHGA/U132 | Fax: +41.56.310.3649 CH-5232 Villigen PSI | Switzerland | ----------------------------------------------------------------- |
| |||
| Padiyath Sreekumaran schrieb: > <?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. $username instead of '$username' same for '$password' but what has this to do with MySQL??? -- Sebastian Mendel |
| |||
| Padiyath Sreekumaran schrieb: > Hello Sebastian, > Thanks for your mail. But I donot see any difference in my $username and yours except > '("). what surprise, yes, thats it! you have to use no quotes at all (or doublequotes) around variables, RTMF is this case the one from PHP >> but what has this to do with MySQL??? > If the above works I want to use mssql_connect command. mssql extension for PHP has absolutely nothing to do with MySQL, or? -- Sebastian Mendel |
| |||
| 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:kumar.padiyath@psi.ch] >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: kumar.padiyath@psi.ch >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/mysql?unsub=jschwartz@the- >infoshop.com |
| ||||
| >-----Original Message----- >From: Jerry Schwartz [mailto:jschwartz@the-infoshop.com] >Sent: Thursday, April 24, 2008 10:01 AM >To: 'Padiyath Sreekumaran'; mysql@lists.mysql.com >Subject: RE: Php-mssql connection problems on Windows XP > >When using odbc_connect, you don't use the DSN you've previously >created. [JS] I should have said you don't NEED to use the DSN. You can, although I haven't myself done so. Doing in your program insulates you from changes made to the name of the DSN names, which happens when people get sloppy. Since you've gotten yours working, I'm not about to argue with success. The manual notes show a couple of different way of specifying a DSN. >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:kumar.padiyath@psi.ch] >>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: kumar.padiyath@psi.ch >>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/mysql?unsub=jschwartz@the- >>infoshop.com > > > > > >-- >MySQL General Mailing List >For list archives: http://lists.mysql.com/mysql >To unsubscribe: http://lists.mysql.com/mysql?unsub=jschwartz@the- >infoshop.com |
| Thread Tools | |
| Display Modes | |
| |