Link to home
Start Free TrialLog in
Avatar of Zmey2
Zmey2

asked on

Connect to MySQL without driver

Is there a way to connect to MySQL database and execute query without installing any driver software on client (like MyODBC ?)

Thanks in advance.
Avatar of MYLim
MYLim

as i know,answer is 'NO' .
here are the links which list out MySQL connection method.

http://www.connectionstrings.com

http://www.able-consulting.com/MDAC/ADO/Connection/ODBC_DSNLess.htm#ODBCDriverForMySQL
//script for connect to mysql db
      $db = "dbxxx";
       $hostname="localhost";
  $username="userxxx";
  $password="xxx";
      
      if (!$dbh=mysql_connect($hostname,$username,$password))
      {
            echo mysql_error();
            exit;      
      }      

  //select default db
      mysql_select_db($db,$dbh);
            
      $sql = "select * from tablex";
                                     
      if (!$res=mysql_query($sql,$dbh))
      {
              echo mysql_error();
             exit;
      }
      $row=mysql_fetch_row($res);
Avatar of Zmey2

ASKER

Is that a php script?
How can i call it from VB?
Ow sorry.

Try this:

***********************************
Dim rs As ADODB.Recordset
dim cn as adodb.Connection

Set cn = CreateObject("ADODB.Connection")

cn.Open "DRIVER={MYSQL};SERVER=MySERVER;DATABASE=User1;UID=sa;PWD=mypassword;"

sql = "select * from mytable"

Set rs = CreateObject("ADODB.RECORDSET")
    rs.Open sql, cn

while not rs.eof
    .
    .
   rs.movenext
wend
rs.close
set rs = nothing
cn.close
set cn=nothing
ASKER CERTIFIED SOLUTION
Avatar of mquiroz
mquiroz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial