首页 > 代码库 > ado连接mysql和ORACLE

ado连接mysql和ORACLE

  ------mysql

strConnect.Format("Provider=MSDASQL.1;Driver={%s};Server=%s;DataBase=%s;UID=%s;PWD=%s;",
  "MySQL ODBC 5.2 Unicode Driver"//strDriver/*MYSQL驱动,如:"MySQL ODBC 3.51 Driver"*/,;
  ,"localhost"//strServerPath/*数据库路径,例子127.0.0.1*/, ;
  ,""//strDb/*数据库名*/, ;
  ,""//strUid/*用户名,默认为root*/, ;
  ,""//strPwd/*密码*/);
  );

------oracle

  _bstr_t strConn = "Provider=OraOLEDB.Oracle.1;Password=密码;Persist Security Info=True;User ID=用户名;Data Source=\"(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = IP地址)(PORT = 端口号)) )(CONNECT_DATA = http://www.mamicode.com/(SID = 数据源)))/"";