Home > Database > Mysql Tutorial > body text

dbexpress 连接 mysql_MySQL

WBOY
Release: 2016-06-01 13:11:30
Original
1223 people have browsed it

program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
 System.SysUtils,data.DB, data.DBXCommon,classes, data.sqlexpr,vcl.dialogs,
 Data.DBXMySQL;
var
 fsqlconn:Tsqlconnection;
begin

 try
   { TODO -oUser -cConsole Main : Insert code here }
   fsqlconn:=TsqlConnection.Create(nil);

  fsqlconn.ConnectionName:='MYSQLCONNECTION';
   fsqlConn.DriverName:='MySQL';
   fsqlConn.LoginPrompt:=false;
   fsqlconn.Params.Clear;

  fsqlConn.Params.Add('VendorLib=F:/soft/database/mysql/LIBMYSQL.dll');
   fsqlconn.Params.Add('ServerCharSet=utf8');
   fsqlconn.Params.Add('HostName=localhost');
   fsqlconn.Params.Add('Database=lzf');
   fsqlConn.Params.Add('User_Name=lzf');
   fsqlConn.Params.Add('Password=123456');
   fsqlconn.Params.Add('Compressed=False');
   fsqlconn.Params.Add('Encrypted=False');

  fsqlConn.Open;
   showmessage('Good');
   fsqlConn.Close;
 except
   on E: Exception do
   begin
     Writeln(E.ClassName, ': ', E.Message);
     showmessage(e.Message);
     fsqlconn.Free;
   end;
 end;

end.

 

 

xe2和xe5的唯一区别是:
Copy after login
<pre class="prettyprint"><p>fsqlconn.VendorLib:='F:/soft/database/mysql/libmysql.dll'; </p>
Copy after login

有点不好的是,好像还是只能支持5.1.63左右的libmysql.dll

也有人说 是 libmysql.dll 版本问题

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template