使用unidac 在linux 上無驅動直接存取MS SQLSERVER

來源:互聯網
上載者:User

標籤:using   classname   訪問   oppo   -o   分享   ora   技術   lease   

隨著delphi 10.2 開始了對Linux 的重新支援。devart 也迅速的發布了unidac 7.0,

最大的特性就是支援linux和MongoDB.

並有了其他更新:

In this release we added such significant features as:

  • The new UniDAC version includes a new MongoDB provider which allows you to work with a cross-platform document-oriented database MongoDB. Its main features are high performance, easy deployment and comprehensive support for the latest versions of the MongoDB server.
  • In DBF provider, we added support for the Direct mode. Using DBF data provider, you can work with a variety of database formats: dBaseIII-dBase10, dBase for Windows, HiPer-Six, FoxPro 2, Visual FoxPro.
  • Now, working with Oracle in the Direct mode becomes more appealing, we supported Oracle 12c authentication, Oracle Cloud (DbaaS), Oracle Encryption, Oracle Data Integrity. We also added support for the ANYDATA type.
  • What is more, for Interbase and Firebird, you have an opportunity to manage batch operations using a transaction and to obtain an active transaction number using DBMonitor.
  • In NexusDB data provider, we added support for using ConnectionString and the TFmtBCD fields.

更多的情況可以訪問官網www.devart.com  .此公司在資料庫存取方面的功力,已經逆天。

今天給大家說的是利用undiac 的直連資料庫功能,在Linux下不安裝任何驅動,訪問MS SQLSERVER 功能。

如果你沒有現成的sql server 資料庫,可以直接在微軟的網頁上下載sql server 2016 express 版,此版本為免費版本。

安裝後,啟動TCP/IP 支援,同時注意windows 防火牆的設定,確保網路訪問正常。

在windows 上,使用用戶端程式,建立一個sql server 資料庫,同時建一個測試表。

輸入一些測試資料

OK, 準備結束。啟動delphi。

建立一個控制台工程。

再建一個datamodule

放上對應的控制項

注意uniconnection 的屬性設定

 

 ok, 設定完畢

回到主程式。

program linuxdata;{$APPTYPE CONSOLE}{$R *.res}uses  System.SysUtils,System.Classes,  dmp in ‘dmp.pas‘ {dmf: TDataModule};var  i:integer;  s:string;begin  try   dmf:=Tdmf.Create(nil);   dmf.UniConnection1.Connected:=true;
   writeln(‘資料庫版本:‘+dmf.UniConnection1.ServerVersionFull); with dmf.cx do begin SQL.Clear; sql.Add(‘select * from TB_user‘); open; for I := 0 to fields.Count-1 do begin write(‘|‘); write( fields[i].FieldName); end; writeln(‘|‘); while not eof do begin for I := 0 to fields.Count-1 do begin write(‘|‘); write( fields[i].AsString) ; end; writeln(‘|‘); next; end; end; writeln(‘打完收功!‘); readln; except on E: Exception do Writeln(E.ClassName, ‘: ‘, E.Message); end;end.

在windows 上運行無誤。

 

添加linux 平台編譯支援

編譯,運行程式

 

 

 結果出來了。與windows 下沒任何區別。

記住:我們沒有在linux 下安裝任何sql server 驅動。

用delphi 就這麼自信!

另外,以上人名,純屬虛構,如有雷同,愛理不理。

 

使用unidac 在linux 上無驅動直接存取MS SQLSERVER

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.