问题
cy f · 九月 3

在centos访问windows上的cache库通过.net 5

我想在centos访问我部署在windows上的cache 数据库, 我使用了**InterSystems.Data.CacheClient.dll **在我的linux程序中,但是它不能正常的在centos机器上运行,但是可以在我的windows平台运行(改windows平台不是安装cache数据库,并且也没有安装任何cache 软件),有人知道这个怎么解决吗?
try
{
if (conn.State != ConnectionState.Open)
{
conn.Open();
}
CacheCommand cmd = new CacheCommand();
cmd.Connection = this.conn;
if (inTransaction)
cmd.Transaction = trans;
DataSet ds = new DataSet();
CacheDataAdapter ad = new CacheDataAdapter();
cmd.CommandText = QueryString;
//CLogger._log.Debug(QueryString);
ad.SelectCommand = cmd;
ad.Fill(ds);
ad.Dispose();
return ds;
}
catch (Exception e2)
{
throw e2;
}

产品版本: Caché 2016.1
00
2 0 5 21
Log in or sign up to continue

I have make a demo for visted cache on centos and write this demo .
it work well on my windows machine but on my linux machein it get this error
`
The Error

System.UnauthorizedAccessException: Access to the path '/root/0000/00/Debug/dbnet5.0' is denied.
---> System.IO.IOException: Permission denied
--- End of inner exception stack trace ---
at System.IO.Enumeration.FileSystemEnumerator1.CreateDirectoryHandle(String path, Boolean ignoreNotFound) at System.IO.Enumeration.FileSystemEnumerator1.Init()
at System.IO.Enumeration.FileSystemEnumerator1..ctor(String directory, Boolean isNormalized, EnumerationOptions options) at System.IO.Enumeration.FileSystemEnumerable1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options)
at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
at System.IO.Directory.GetFiles(String path, String searchPattern)
at Microsoft.DotNet.CommandFactory.ProjectFactory.GetMSBuildProjPath(String projectDirectory)
at Microsoft.DotNet.CommandFactory.ProjectFactory.GetMSBuildProj(String projectDirectory, NuGetFramework framework, String configuration, String outputPath)
at Microsoft.DotNet.CommandFactory.ProjectToolsCommandResolver.ResolveFromProjectTools(CommandResolverArguments commandResolverArguments)
at Microsoft.DotNet.CommandFactory.ProjectToolsCommandResolver.Resolve(CommandResolverArguments commandResolverArguments)
at Microsoft.DotNet.CommandFactory.CompositeCommandResolver.Resolve(CommandResolverArguments commandResolverArguments)
at Microsoft.DotNet.CommandFactory.CommandResolver.TryResolveCommandSpec(ICommandResolverPolicy commandResolverPolicy, String commandName, IEnumerable1 args, NuGetFramework framework, String configuration, String outputPath, String applicationName) at Microsoft.DotNet.CommandFactory.CommandFactoryUsingResolver.Create(ICommandResolverPolicy commandResolverPolicy, String commandName, IEnumerable1 args, NuGetFramework framework, String configuration, String outputPath, String applicationName)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
at Microsoft.DotNet.Cli.Program.Main(String[] args)

`

try { if (conn.State != ConnectionState.Open) { conn.Open(); } CacheCommand cmd = new CacheCommand(); cmd.Connection = this.conn; if (inTransaction) cmd.Transaction = trans; DataSet ds = new DataSet(); CacheDataAdapter ad = new CacheDataAdapter(); cmd.CommandText = QueryString; //CLogger._log.Debug(QueryString); ad.SelectCommand = cmd; ad.Fill(ds); ad.Dispose(); return ds; } catch (Exception e2) { throw e2; }

can anyone hava a look for this?

根据您附上的异常,可以首先看到操作系统报出了对dbnet5.0文件夹的访问被拒绝。因此需要检查您的文件夹权限设置,确保IRIS的运行账户拥有对这个文件夹的访问权限

另外,dll是原生在Windows的动态链接库,在Linux上运行dll并没有保障,建议您换用jdbc等其他平台无关的技术实现跨操作系统访问。

但是我使用的是centos 和 .net 我可能需要安装odbc去访问它,但是我应该怎么安装odbc去访问呢?我没有在网站上找到odbc的驱动包

我感觉我是不是应该使用odbc去访问他们,但是我找不到odbc的驱动,我应该怎么做?

您好,由于ODBC也是原生于Windows平台的接口访问标准,因此,虽然可以尝试在Linux上使用ODBC,但缺少官方的测试和保障,不能保证ODBC可以在Linux正常工作。如果可能,建议在Linux采用JDBC连接数据库。

如果您具有WRC账户,可以登录WRC下载独立的ODBC驱动包