在 WIndows 上测试 ODBC 的最简单方法

发布于 2024-08-29 22:13:58 字数 134 浏览 2 评论 0原文

通过 unixODBC,您可以使用一个名为“isql”的简单命令行实用程序来测试您的连接和某些查询的权限。无需编写额外的代码或安装库或臃肿的程序,是否有一种简单的方法来打开X数据源发送一些sql命令并完成它?

在命令行上执行此操作会更好。

With unixODBC you can use a simple command line utility called "isql" to test your connection and permissions of some queries. Without having to write extra code or install libs or bloated programs, is there a simple way to open up X data source send some sql commands and be done with it?

Doing this on the command line would be preferable.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

瑶笙 2024-09-05 22:13:58

通过 ODBC 连接在 Windows 中创建快速测试查询的一种方法是使用 DQY 格式。

要实现此目的,请创建一个 DQY 文件(例如 test.dqy),其中包含如下所示的神奇前两行(XLODBC 和 1),后跟第三行上的 ODBC 连接字符串以及对第四行(全部在一行),例如:

XLODBC
1
Driver={Microsoft ODBC for Oracle};server=DB;uid=scott;pwd=tiger;
SELECT COUNT(1) n FROM emp

然后,如果您通过双击打开该文件,它将在 Excel 中打开并使用查询结果填充工作表。

One way to create a quick test query in Windows via an ODBC connection is using the DQY format.

To achieve this, create a DQY file (e.g. test.dqy) containing the magic first two lines (XLODBC and 1) as below, followed by your ODBC connection string on the third line and your query on the fourth line (all on one line), e.g.:

XLODBC
1
Driver={Microsoft ODBC for Oracle};server=DB;uid=scott;pwd=tiger;
SELECT COUNT(1) n FROM emp

Then, if you open the file by double-clicking it, it will open in Excel and populate the worksheet with the results of the query.

臻嫒无言 2024-09-05 22:13:58

创建一个文件 SOMEFILENAME.udl 然后双击它并将其设置为 ODBC 连接对象、用户名、密码、目标服务器

Make a file SOMEFILENAME.udl then double click on it and set it up as an ODBC connection object, username, pwd, target server

篱下浅笙歌 2024-09-05 22:13:58

对于临时查询,ODBC 测试实用程序非常方便。它的设计和界面更面向测试 ODBC API 的各个部分。但它对于运行查询和显示输出非常有效。它是 Microsoft 数据的一部分访问组件

要运行查询,您可以单击连接按钮(或使用 ctrl-F),选择数据源,键入查询,然后 ctrl-E 执行它并ctrl-R 显示结果(例如,如果它是 SELECT 或返回光标的内容)。

For ad hoc queries, the ODBC Test utility is pretty handy. Its design and interface is more oriented toward testing various parts of the ODBC API. But it works quite nicely for running queries and showing the output. It is part of the Microsoft Data Access Components.

To run a query, you can click the connect button (or use ctrl-F), choose a data source, type a query, then ctrl-E to execute it and ctrl-R to display the results (e.g., if it is a SELECT or something that returns a cursor).

黯淡〆 2024-09-05 22:13:58

通过“控制面板”>“创建 ODBC 连接”后,您可以使用“测试连接”功能。管理工具>数据源。

要测试 SQL 命令本身,您可以尝试:

http://www.sqledit.com/odbc/runner .html

http://www.sqledit.com/sqlrun.zip

或 (从长远来看,也许更容易、更有用)您可以在几分钟内制作一个测试 ASP.NET 或 PHP 页面,以便通过 IIS 自行运行 SQL 语句。

You can use the "Test Connection" feature after creating the ODBC connection through Control Panel > Administrative Tools > Data Sources.

To test a SQL command itself you could try:

http://www.sqledit.com/odbc/runner.html

http://www.sqledit.com/sqlrun.zip

Or (perhaps easier and more useful in the long run) you can make a test ASP.NET or PHP page in a couple minutes to run SQL statement yourself through IIS.

我的奇迹 2024-09-05 22:13:58

一个简单的方法是:

在桌面上创建一个假的“*.UDL”文件

(UDL文件描述如下:
https://msdn.microsoft.com/en -us/library/e38h511e(v=vs.71).aspx

如果您还可以按照此处的说明对其进行自定义。 )

a simple way is:

create a fake "*.UDL" file on desktop

(UDL files are described here:
https://msdn.microsoft.com/en-us/library/e38h511e(v=vs.71).aspx.

in case you can also customized it as explained there. )

楠木可依 2024-09-05 22:13:58

已经有一段时间了,但由于我确切地知道了这个问题的答案,我将分享它,也许有人会从中受益。

Jaime de Los Hoyos 编写了一个非常好的程序来精确地做到这一点:ODBC 查询工具。
不幸的是,Jaime 的网站已关闭,但您仍然可以在此位置找到该程序及其源代码:
https://sourceforge.net/projects/odbc-query-tool/files /latest_release/

该程序基于 GUI,由单个可执行文件组成,无需在计算机上安装任何内容。

Jaime 的个人资料:https://stackoverflow.com/users/878998/jaime-de-los-hoyos -m
Jaime 在论坛上的帖子谈论他的程序:https://forum.powerbasic.com/forum/user-to-user-discussions/source-code/48266-odbc-query-tool-retrieve-轻松地从任何数据库获取信息

It's been a while but since I precisely have the answer to the question, I'll share it and maybe someone will benefit from it.

Jaime de Los Hoyos wrote a very nice program to precisely do that: ODBC Query Tool.
Unfortunately, Jaime's website is defunct but you can still find the program and its source code at this location:
https://sourceforge.net/projects/odbc-query-tool/files/latest_release/

The program is GUI based and consists of a single executable file, no need to install anything on the machine.

Jaime's profile : https://stackoverflow.com/users/878998/jaime-de-los-hoyos-m
Jaime's posts on a forum talking about his program : https://forum.powerbasic.com/forum/user-to-user-discussions/source-code/48266-odbc-query-tool-retrieve-information-from-any-database-easily

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文