Powershell连接到Firebird [英] Powershell connect to firebird

查看:99
本文介绍了Powershell连接到Firebird的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我想知道如何从Powershell中连接到Firebird数据库(gdb)文件.有没有一种方法可以使用.net数据提供程序进行Firebird连接?有没有办法将System.Data.Odbc.OdbcConnection连接到firebird?

Hey I was wondering how one could connect to a firebird database (gdb) file from within powershell. Is there a way to use the .net data provider for firebird to connect? Is there a way to connect with System.Data.Odbc.OdbcConnection to firebird?

推荐答案

@Alexandr的代码来自

The code from @Alexandr is from https://www.andersrodland.com/working-with-odbc-connections-in-powershell/

我建议您阅读全文.尽管他也没有完全解释代码,但我认为它是相当自说明的,唯一缺少的信息是如何获取/使用Firebird驱动程序.

I suggest you read the entire thing. While he isn't exactly explaining the code either, I think it's fairly self-documenting, the only information that is missing, is how to get/use the Firebird driver.

您可以从firebird > https://www.firebirdsql.org获取ODBC驱动程序安装程序/en/odbc-driver/

You can get the ODBC driver installer from firebird https://www.firebirdsql.org/en/odbc-driver/

安装后,打开Windows ODBC管理(odbcad32.exe),检查驱动程序选项卡,确保"Firebird/Interbase(r)驱动程序"在那里.

After Installing it, open windows ODBC administration (odbcad32.exe), check the drivers tab to make sure that the "Firebird/Interbase(r) driver" is there.

在这里,您可以使用该驱动程序名称来运行@Alexandr的代码

From here you can either use that driver name to run @Alexandr 's code

$connStr = "Driver=Firebird/Interbase(r) driver;Server=localhost;Port=****;Database=*.fdb;Uid=user;Pwd=userpassword;"

或转到用户DSN"选项卡或系统DSN"选项卡.单击添加,选择firebird驱动程序,使用名称,数据库路径以及通常需要的其他所需数据库注册信息来设置DSN.保持DSN名称简单,这是您将使用的标识符.

OR Go to either the User DSN tab, or the system DSN tab. Click add, select the firebird driver, set up the DSN with a name, the path to your database and the other required database registration info you normally would. Keep the DSN name simple, it's an identifier you will use.

然后,您可以简单地将$ constr替换为

Then you can simply replace the $constr with

$connStr = "DSN=YourDsnName;"

这篇关于Powershell连接到Firebird的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆