用FireDAC连接oracle(接近直连)

新建一个工程。将TFDConnection,TFDQuery,TFDGUIxWaitCursor,TDataSource,TDBGrid控件拖入到一个form中。把oracle的以下几个dll文件放到windows的path路径下。

oci.dll
oraocci11.dll
oraociei11.dll
orasql11.dll

在form的create事件中:


  1. con1.Params.Add('DriverID=Ora');  

  2. con1.Params.Add('Database=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = OraSrv)(PORT = 1521)))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = orcl)))');  

  3. con1.Params.Add('User_Name=scott');  

  4. con1.Params.Add('Password=tiger');  

  5. con1.Params.Add('CharacterSet=UTF8');  //否则中文乱码  

  6. con1.Connected := True;  

  7. fdqry1.Open('select * from emp');


联系电话:
020-00000000
联系电话:
020-00000000
联系电话:
020-12345678