Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-24-2008, 06:08 PM
Padiyath Sreekumaran
 
Posts: n/a
Default 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 |
-----------------------------------------------------------------
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-24-2008, 06:08 PM
Sebastian Mendel
 
Posts: n/a
Default Re: Php-mssql connection problems on Windows XP

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-24-2008, 06:08 PM
Sebastian Mendel
 
Posts: n/a
Default Re: Php-mssql connection problems on Windows XP

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-24-2008, 06:08 PM
Jerry Schwartz
 
Posts: n/a
Default RE: Php-mssql connection problems on Windows XP

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





Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-24-2008, 06:08 PM
Jerry Schwartz
 
Posts: n/a
Default RE: Php-mssql connection problems on Windows XP

>-----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





Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:28 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145