Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Mysql database Connection-Using Ajax with Javascript

    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.
    Last edited by jmohan; 04-29-2008 at 03:05 PM.

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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)
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •