...

View Full Version : Mysql database Connection-Using Ajax with Javascript



jmohan
04-29-2008, 03:02 PM
Dear All,

I am developing a toolbar. I need to make a mysql database connection using javascript and AJAX. The following Javascript I tried:

var xmlHttp=null;

try
{
var adoConn = new ActiveXObject("ADODB.Connection");

xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");

xmlHttp.Open("GET","c:\sample2.js",true);

xmlHttp.send(null);

}
catch(err)
{
alert(err.description);
}


The Javascript file(sample2.js) as follows:

var adoConn = new ActiveXObject("ADODB.Connection");
adoConn.Open("Driver={MySQL ODBC 3.51 Driver}; Server=system2; uid = root; pwd = harsha1; Database=RemoteConnect;");

I tried this above script, but the mysql database connection is not established. please help me.


Thanks in Advance,

J. Mohan.

Kor
04-29-2008, 03:27 PM
well... hm... I would have done otherwise. I would have sent the AJAX request to a server-side application file (php would be the best) which makes the connection with DB and send back to the AJAX object whichever you need from that DB as a response. Should be also a crossbrowser solution (ActiveX is IE only)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum