博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用unidac 在linux 上无驱动直接访问MS SQL SERVER
阅读量:7036 次
发布时间:2019-06-28

本文共 2450 字,大约阅读时间需要 8 分钟。

随着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.

更多的情况可以访问官网  .此公司在数据库存取方面的功力,已经逆天。

今天给大家说的是利用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 就这么自信!

另外,以上人名,纯属虚构,如有雷同,爱理不理。

 

转载地址:http://uynal.baihongyu.com/

你可能感兴趣的文章
使用StarWind构建Hyper-V Server群集实时迁移
查看>>
读十六进制文本到 Btye 数组的函数 - 回复 "峰哥!!!" 的问题
查看>>
Delphi XE2 之 FireMonkey 入门(41) - 控件基础: TListBox
查看>>
tp框架的ajax验证用户姓名的比较
查看>>
linux系统里模拟并发请求siege
查看>>
自定义View 购物车加减数量
查看>>
mybatis 打印sql语句
查看>>
git项目时遇到的问题
查看>>
做一个好的程序猿
查看>>
Testlink安装使用
查看>>
Android系统性能调优工具介绍
查看>>
chrome插件 Markdown-here
查看>>
我的友情链接
查看>>
DB2--迁移数据库--2012-12-02
查看>>
C语言精简快排代码,带注释
查看>>
Greenplum如何激活、同步、删除Standby恢复原始Master
查看>>
技术往事:改变世界的TCP/IP协议(珍贵多图、手机慎点)
查看>>
减少tcp连接中的time_wait
查看>>
国内一款仅需150M内存的开源JAVA企业网站系统-MiinE
查看>>
基于maven使用IDEA创建springboot多模块项目
查看>>