Delphi 2010安装及使用UniDAC 4.0 .

Delphi 2010安装及使用UniDAC 4.0 .

Delphi 2010安装及使用UniDAC 4.0 .

分类: unidac 77人阅读 评论(0) 收藏 举报

UniDAC是一个功能强大的非可视化跨数据库的数据访问组件,可用于Delphi,Delphi for .NET,C++Builder,and Lazarus (Free Pascal)。它提供了对流行数据库服务器的统一访问,像Oracle,Microsoft SQL Server,MySQL,InterBase,Firebird,PostgreSQL,SQLite,DB2,Microsoft Access,Sybase Advantage Database Server,Sybase Adaptive Server Enterprise,和其他数据库(使用ODBC驱动)。        
        从网上下载到UniDAC 4.0的源码版本,安装过程如下:
        1.进入"...\unidac40src\Source\Delphi14"文件夹,找到"Make.bat"文件,打开并修改IDE目录路径,如下:

set IdeDir="%PROGRAMFILES%\Embarcadero\RAD Studio\7.0 
call ..\Make.bat Delphi 14 WIN32 

        因为我这里Delphi 2010不是安装在默认位置,故修改如下:

set IdeDir="D:\Program Files\Embarcadero\RAD Studio\7.0 
call ..\Make.bat Delphi 14 WIN32 

        2.执行"Make.bat"文件,自动执行一系列操作后,到"...\unidac40src\Bin\Delphi14"目录下,可发现库已经生成完毕;
        3.运行Delphi 2010,菜单→"Tools"→"Options"→"Environment Options"→"Environment Variables",添加"...\unidac40src\Bin\Delphi14"完整路径到"PATH"环境变量;
        4.菜单→"Component"->"Install Packages...","Add"添加"...\unidac40src\Bin\Delphi14"目录下的"dclunidac140.bpl";
        5.菜单→"Tools"→"Options"→"Environment Options"→"Delphi Options"→"Library - Win32",在"Library Path"添加"...\unidac40src\Lib\Delphi14"路径;
        6.此时,已可以使用UniDAC连接数据库了。若是需要链接查看源代码,将"...\unidac40src\Source"路径也添加到"Library Path"。
        
        测试连接MySql数据库:
        1.新建一个应用程序,在面板上拖动TUniConnection、TMySQLUniProvider、TUniQuery、TUniDataSource、TDBGrid到窗体上,如下图所示:

        2.右键TUniConnection,选择"Connection Editor...",填入数据库连接参数,如下图所示:
 

        3.因为MySql一般设置字符集为UTF-8,而Delphi 2010工程字符集是Unicode,在"Options"页面,设置"UseUnicode"为True,这可以通知服务器,客户端和服务器双方之间的所有数据都将通过UTF-8编码,设置这个选项会转换所有的TStringField字段类型到TWideStringField字段类型,使得几乎所有的语言符号都可以正确工作,但另一方面,也引起工作延迟。

        4.关联其他项,在TUniQuery的SQL里面写"select * from city",设置Active为True,运行程序,可以看到符号都可以正常显示,如下图所示:

        代码实现的方式如下:

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 procedure TForm1.FormCreate(Sender: TObject); 
begin 
  UniQuery1.Connection := UniConnection1; 
  UniDataSource1.DataSet := UniQuery1; 
  DBGrid1.DataSource := UniDataSource1; 
  with UniConnection1 do 
  begin 
    ProviderName := 'MySQL'
    Username := 'root'
    Password := '123'
    Server := '192.168.82.201'
    Database := 'world'
    Port := 3306
    SpecificOptions.Values['UseUnicode'] := 'True'
    try 
      Connect; 
      UniQuery1.Close; 
      UniQuery1.SQL.Text := 'select * from city'
      UniQuery1.Open; 
    except 
 
    end
  end
end
分类: Delphi

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Devart UniDAC v5.3.10 Full Source 5.3.10 31-Jul-14 -The EmptyTable method is added to TUniTable -The SQL property is added to TUniConnection -Support for the Upper and Lower statements in TDADataSet.Filter is added -Support for the ftOraTimeStamp type in TVirtualTable is added -Bug with reopening TDADataSet after BreakExec is fixed -Bug with processing calculated and lookup fields in the SmartFetch mode is fixed -Bug with getting RecordCount when QueryRecordCount is True is fixed -Bug with AV failure on opening TCustomDADataSet when Range was set is fixed -Bug with "Invalid field size" in TVirtualTable is fixed -Bug with AV failure on freeing objects on mobile platforms is fixed -Several bugs in the SmartFetch mode are fixed Oracle data provider -Data type mapping from RAW(16) to ftGuid is added -Now result parameter detection in UniConnection.ExecSQL is similar to the one in ODAC -Bug with connection establishing if the client has negative half-hour time zone is fixed -Bug with transactions in the OCI7 mode is fixed -Bug with tnsnames.ora parsing is fixed -Bug with parsing table names a if sub-query contains a WITH keyword is fixed SQLServer data provider -Bug with opening a query with too long columns is fixed -Bug with cutting an input-output parameter value is fixed -Bug with processing identity field is fixed -Bug with processing tinyint fields is fixed -Bug with processing tinyint and bigint parameters in SQL Server Compact Edition is fixed -Bug with the Integer Overflow error on query preparation when DescribeParams is True is fixed -Bug with getting metadata in MS SQL Server 64 bit is fixed MySQL data provider -Possibility to retrieve time values greater than 24:00:00 for a Time field is added -Bug in TMyDump with data backup in the Unicode mode is fixed InterBase data provider -The NoDBTriggers connection option is added -Bug with query execution when AutoPrepare = True is fixed PostgreSQL data provider -Bug with incorrect parsing of table names containing a "$" character is fixed

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值