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

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

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

 

目录
相关文章
|
监控 Linux 开发者
理解Linux操作系统内核中物理设备驱动(phy driver)的功能。
综合来看,物理设备驱动在Linux系统中的作用是至关重要的,它通过与硬件设备的紧密配合,为上层应用提供稳定可靠的通信基础设施。开发一款优秀的物理设备驱动需要开发者具备深厚的硬件知识、熟练的编程技能以及对Linux内核架构的深入理解,以确保驱动程序能在不同的硬件平台和网络条件下都能提供最优的性能。
699 0
|
SQL 开发框架 .NET
【YashanDB知识库】使用c-调用yashandb odbc驱动执行SQL时报YAS-08008 not all variables bounded
本文来自YashanDB官网,讨论了某客户在使用C# ASP.NET应用时遇到的异常问题。问题表现为YashanDB ODBC驱动不支持.NET框架通过绑定变量执行SQL语句,导致应用无法正常运行。该问题影响所有YashanDB版本及其ODBC驱动版本。解决方法包括避免使用绑定变量或升级ODBC驱动版本。文章通过示例代码展示了问题复现过程,并总结了最小化问题场景以定位和解决问题的经验。
|
SQL 开发框架 .NET
【YashanDB 知识库】使用 c- 调用 yashandb odbc 驱动执行 SQL 时报 YAS-08008 not all variables bounded
某客户C# ASP.NET应用在使用yashandb ODBC驱动时,因驱动不支持绑定变量执行SQL语句而报错“YAS-08008 not all variables bounded”,导致应用无法正常运行。影响所有yashandb及ODBC驱动版本。解决方法为避免使用绑定变量或升级驱动版本。通过简化场景成功复现问题。
|
SQL Oracle 数据库
使用访问指导(SQL Access Advisor)优化数据库业务负载
本文介绍了Oracle的SQL访问指导(SQL Access Advisor)的应用场景及其使用方法。访问指导通过分析给定的工作负载,提供索引、物化视图和分区等方面的优化建议,帮助DBA提升数据库性能。具体步骤包括创建访问指导任务、创建工作负载、连接工作负载至访问指导、设置任务参数、运行访问指导、查看和应用优化建议。访问指导不仅针对单条SQL语句,还能综合考虑多条SQL语句的优化效果,为DBA提供全面的决策支持。
516 11
|
SQL 运维 监控
南大通用GBase 8a MPP Cluster Linux端SQL进程监控工具
南大通用GBase 8a MPP Cluster Linux端SQL进程监控工具
|
SQL 关系型数据库 BI
使用 Webshell 访问 SQL Server 主机并利用 SSRS
使用 Webshell 访问 SQL Server 主机并利用 SSRS
|
Java Linux API
Linux设备驱动开发详解2
Linux设备驱动开发详解
439 6
|
消息中间件 算法 Unix
Linux设备驱动开发详解1
Linux设备驱动开发详解
690 5
|
Ubuntu NoSQL Linux
Linux内核和驱动
Linux内核和驱动
317 2
|
Linux API
Linux里的高精度时间计时器(HPET)驱动 【ChatGPT】
Linux里的高精度时间计时器(HPET)驱动 【ChatGPT】