- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我们在 RedHat 6.5 中使用 Mono。我们正在尝试使用 ODBC 连接到本地数据库。当我们尝试连接时,我们收到一条错误消息 ERROR - 无法启用连接池。我试图通过设置 Pooling=false 来禁用池化;在连接字符串中。
完全相同的代码在 Windows 7 上运行良好。任何帮助将不胜感激。使用 PHP,我们可以毫无问题地连接到数据库。如果有任何不同的话,它是一个 Progress OpenEdge 数据库。
这是我们的设置。
odbcinst.ini 设置如下:
[Progress]
Description = ODBC for Progress
Driver = /usr/dlc64Bit/odbc/lib/pgoe27.so
FileUsage = 1
[ODBC]
Pooling = True
Trace = Yes
TraceFile = /home/rr/progress/trace.log
UseCursorLib = 1
UsageCount = 2
odbc.ini 设置如下:
[my_progress]
Driver=Progress
Description=Test to Progress
DatabaseName=pt
PortNumber=9003
HostName=localhost
LoginID=
Password=
APILevel=1
ConnectFunctions=YYN
CPTimeout=60
DriverODBCVer=03.60
FileUsage=0
SQLLevel=0
UsageCount=1
ArraySize=50
DefaultLongDataBuffLen=2048
DefaultIsolationLevel=REPEATABLE READ
StaticCursorLongColBuffLen=4096
ODBC 使用 PHP 工作正常!
这是单声道程序:
using System;
using System.Data;
using System.Data.Odbc;
public class Test
{
string connectionString, sql;
public void testProgress()
{
System.Console.WriteLine("Testing Progress");
connectionString =
"DSN=my_progress;" +
"UID=root;" +
"PWD=root;" +
"Pooling=false";
sql =
"SELECT productcode, prodtype FROM pub.locations";
}
public void testConnection()
{
try
{
IDbConnection dbcon;
dbcon = new OdbcConnection(connectionString);
dbcon.Open();
IDbCommand dbcmd = dbcon.CreateCommand();
dbcmd.CommandText = sql;
IDataReader reader = dbcmd.ExecuteReader();
while(reader.Read()) {
string product = (string) reader["productcode"];
string producttype = (string) reader["prodtype"];
Console.WriteLine(product + " " + producttype);
}
// clean up
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
}
catch(Exception ex)
{
System.Console.WriteLine("Error: " + ex.Message);
}
}
public static void Main(string[] args)
{
Test test = new Test();
test.testProgress();
test.testConnection();
}
}
当我编译后运行程序时,出现以下错误:
错误 - 无法启用连接池
最佳答案
Progress OpenEdge 有线协议(protocol)驱动程序不支持连接池。请参阅文档:
ODBC connection pooling on UNIX/Linux is not implemented in the ODBC Driver manager. Instead it is implemented in (some of) the DataDirect ODBC drivers.
但它看起来像是在 .NET/Mono 中默认使用:
.../mono-4.2.3/external/referencesource/System.Data/System/Data/Odbc/OdbcEnvironmentHandle.cs:
...
//Turn on connection pooling
//Note: the env handle controls pooling. Only those connections created under that
//handle are pooled. So we have to keep it alive and not create a new environment
//for every connection.
//
retcode = UnsafeNativeMethods.SQLSetEnvAttr(
this,
ODBC32.SQL_ATTR.CONNECTION_POOLING,
ODBC32.SQL_CP_ONE_PER_HENV,
ODBC32.SQL_IS.INTEGER);
switch(retcode) {
case ODBC32.RetCode.SUCCESS:
case ODBC32.RetCode.SUCCESS_WITH_INFO:
break;
default:
Dispose();
throw ODBC.CantEnableConnectionpooling(retcode);
}
...
我遇到以下异常(使用根据我的环境调整的示例代码 - Linux、Ubuntu 14.04、Mono JIT 编译器版本 4.2.3(稳定版 4.2.3.4/832de4b Wed Mar 16 13:19:08 UTC 2016) ):
[ERROR] FATAL UNHANDLED EXCEPTION:
System.InvalidOperationException: ERROR - unable to enable connection pooling...
----->>> at System.Data.Odbc.OdbcEnvironmentHandle <<-----..ctor () <0x411a0b80 + 0x00097> in <filename unknown>:0
--------------------------------------
at System.Data.Odbc.OdbcEnvironment.GetGlobalEnvironmentHandle () <0x411a05c0 + 0x000bf> in <filename unknown>:0
...
关于c# - 在 Red Hat Linux 上使用带有 Mono 的 ODBC 时无法打开连接池错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34009019/
这个问题已经有答案了: what is the difference between OLE DB and ODBC data sources? (11 个回答) 已关闭10 年前。 OLEDB 和
我正在制作安装脚本并且我正在使用 ODBC,我如何自动将节点添加到 ODBC 数据源。 使用 Visual Studio 安装项目构建安装程序,但我能够为其运行任何脚本。 谢谢。 最佳答案 1) OD
所以我正在将一个旧的 filemaker 数据库传输到 MySQL,一些重复的字段给我带来了一些问题。我读过 ODBC 标准支持这些字段,只有当它们的类型是“文本”并且每个重复都与某个定界符( see
一个月前,我向一个哥们展示了如何使用 .NET 来查询 MySQL。它工作得很好,但他不明白为什么我们需要一个 MySQL 与 ODBC 结合的“驱动程序”。他认为 ODBC 就足够了。 当他问我为什
为什么 ODBC 很慢?底层架构是什么?有人可以对此多加关注> 最佳答案 一般来说(我的意思是 GENERAL)ODBC 驱动程序在混合中添加了另一层。它必须接受您的查询并将其转换为本地查询语言(本地
问题:我正在使用 AsteriskNow,它在 VirtualBox 中运行 asterisk 2.0 服务器。我想使用 ODBC 模块将 Asterisk 与 MySQL 数据库连接起来。但它失败了
我有一个名为“myodbc”的用户定义的 ODBC 连接,其中保存了用户名和密码。这是管理员为我创建的,因此我无法访问凭据。 如何在不传递凭据的情况下与 SAS 建立连接。我认为以下工作会,但我收到无
我最近发现 libname 语句对于访问驻留在 odbc 中的表非常方便。但我不知道如何访问那些具有两级名称的表。下面是一个例子。 我使用的旧代码(此代码有效): proc sql; conn
我们通常使用 MS Visual Foxpro v9.0 SP1、语言、表格和报告。但是,有时我们使用 ODBC 驱动程序连接到表。 ODBC 驱动程序是为 Foxpro v6 编写的,不支持某些嵌套
我第一次尝试在使用 PostgreSQL 9 的 Windows XP Pro 上打开一个程序。我收到一条错误消息: A problem was encountered while trying to
我有一个 spark 集群设置,并在我的数据集上尝试了 native scala 和 spark sql,该设置似乎在大多数情况下都有效。我有以下问题 从 ODBC/外部连接到集群,我应该期待什么?
我正在尝试为 Hive 设置 ODBC 连接。我按照以下步骤操作,但没有成功。 用户 DSN-->添加--> Hortonworks Hive ODBC 驱动程序--> 我提供了以下详细信息 主机:主
我找不到任何文档或示例。到目前为止,我可以成功连接,但是我不知道选择和返回数据的语法。 :odbc.start() {:ok, conn} = :odbc.connect('DSN=mydsn;UID
我正在阅读一篇有关数据透视缓存的 MS Excel 帮助文章,并想知道 OLE DB 和 ODBC 源 的含义 ...You should use the CommandText property i
从应用程序调用 SQLColAttribute 时出现 SQL_INVALID_HANDLE 错误(尝试与自行开发的 odbc 驱动程序通信)我不知道为什么句柄被声明为无效句柄,因为它是一个简单的结构
我有一个简单的 SQL,需要通过 ODBC 调用 RedShift。SQL是这样的 SELECT id as Tag From SomeView 这根本不起作用。它给了我错误 DataSource.E
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
从应用程序调用 SQLColAttribute 时出现 SQL_INVALID_HANDLE 错误(尝试与自行开发的 odbc 驱动程序通信)我不知道为什么句柄被声明为无效句柄,因为它是一个简单的结构
我有一个简单的 SQL,需要通过 ODBC 调用 RedShift。SQL是这样的 SELECT id as Tag From SomeView 这根本不起作用。它给了我错误 DataSource.E
我正在尝试使用 BIML 生成自动暂存区域。源数据库为Progress,通过ODBC连接。 我正在使用以下演练: https://www.cathrinewilhelmsen.net/2015/07/
我是一名优秀的程序员,十分优秀!