使用unidac 在linux 上无驱动直接访问MS SQL SERVER

本文涉及的产品
云数据库 MongoDB,独享型 2核8GB
推荐场景:
构建全方位客户视图
RDS SQL Server Serverless,2-4RCU 50GB 3个月
推荐场景:
云数据库 RDS SQL Server,基础系列 2核4GB
简介: 随着delphi 10.2 开始了对Linux 的重新支持。devart 也迅速的发布了unidac 7.0, 最大的特性就是支持linux和MongoDB. 并有了其他更新: In this release we added such significant features as: T...

随着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 就这么自信!

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

 

相关实践学习
使用SQL语句管理索引
本次实验主要介绍如何在RDS-SQLServer数据库中,使用SQL语句管理索引。
SQL Server on Linux入门教程
SQL Server数据库一直只提供Windows下的版本。2016年微软宣布推出可运行在Linux系统下的SQL Server数据库,该版本目前还是早期预览版本。本课程主要介绍SQLServer On Linux的基本知识。 相关的阿里云产品:云数据库RDS SQL Server版 RDS SQL Server不仅拥有高可用架构和任意时间点的数据恢复功能,强力支撑各种企业应用,同时也包含了微软的License费用,减少额外支出。 了解产品详情: https://www.aliyun.com/product/rds/sqlserver
目录
相关文章
|
28天前
|
域名解析 网络协议 安全
在Linux中,想在命令行下访问某个网站,并且该网站域名还没有解析,如何做?
在Linux中,想在命令行下访问某个网站,并且该网站域名还没有解析,如何做?
|
24天前
|
Java Linux API
Linux设备驱动开发详解2
Linux设备驱动开发详解
23 6
|
24天前
|
消息中间件 算法 Unix
Linux设备驱动开发详解1
Linux设备驱动开发详解
23 5
|
25天前
|
Ubuntu NoSQL Linux
Linux内核和驱动
Linux内核和驱动
16 2
|
27天前
|
JavaScript Linux 应用服务中间件
【Azure 应用服务】FTP 部署 Vue 生成的静态文件至 Linux App Service 后,访问App Service URL依旧显示Azure默认页面问题
【Azure 应用服务】FTP 部署 Vue 生成的静态文件至 Linux App Service 后,访问App Service URL依旧显示Azure默认页面问题
|
17天前
|
Linux API
Linux里的高精度时间计时器(HPET)驱动 【ChatGPT】
Linux里的高精度时间计时器(HPET)驱动 【ChatGPT】
|
27天前
|
JavaScript Linux 容器
【Azure 应用服务】NodeJS项目部署在App Service For Linux环境中,部署完成后应用无法访问
【Azure 应用服务】NodeJS项目部署在App Service For Linux环境中,部署完成后应用无法访问
|
28天前
|
监控 网络协议 Linux
在Linux中,如何使用 tcpdump 嗅探 80 端口的访问看看谁最⾼?
在Linux中,如何使用 tcpdump 嗅探 80 端口的访问看看谁最⾼?
|
存储 SQL 程序员
【Sql Server】存储过程通过作业定时执行按天统计记录
通过前两篇文章的学习,我们已经对创建表、存储过程、作业等功能点有所了解 本次将结合前面所学习的知识点,创建统计表以及结合作业定时按天以及实时统计域名各个长度的记录值
376 0
【Sql Server】存储过程通过作业定时执行按天统计记录
|
存储 SQL 数据库
SQL Server——为什么要使用存储过程?不使用是什么样的?
提高数据库执行速度,可能第一次见到这句话的小伙伴们感觉到非常的匪夷所思叭!怎么就提高了它的执行速度捏,从哪方面可以表现出来呢?既然这里要说到的是为什么要使用存储过程,也就是说它的优点是什么。那我们肯定就要对使用和不使用存储过程两方面来进行对比才能看出它的优点对吧。