Advertisement
RibaSoft

Acesso MariaDB com MySQL56Connection

Jan 3rd, 2023 (edited)
1,717
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.65 KB | None | 0 0
  1.   //Com o componente MySQL56Connection e SQLQuery nativos do Lazarus
  2.   uses
  3.   mysql56conn, SQLDB;
  4.  
  5.   Conexao := TMySQL56Connection.Create(nil);
  6.   Transaction := TSQLTransaction.Create(nil);
  7.   Query: TSQLQuery.Create(nil);
  8.  
  9.   with Conexao do
  10.   begin
  11.     UserName := 'usuario';
  12.     Password := 'senha';
  13.     DatabaseName := 'nome_banco';
  14.     HostName := 'ip_ou_site';
  15.     Port := 3306;
  16.     Transaction := Transaction;
  17.   end;
  18.  
  19.   Query.DataBase := Conexao;
  20.  
  21.   //Confirmar Transação
  22.   Transaction.Commit;
  23.  
  24.   //Cancelar transação
  25.   Transaction.Rollback;
  26.  
  27.   //Fechar a conexao ao termino
  28.   Conexao.Close(True);
  29.  
  30.   //Dll
  31.   libmysql.dll
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement