通过Windows Service(Win 7 x64)进行ODBC [英] ODBC through Windows Service (Win 7 x64)

查看:167
本文介绍了通过Windows Service(Win 7 x64)进行ODBC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近移动了我的开发人员.从XP到Windows 7 64位的环境.由于旧的库兼容性,我们仍然需要使用VS 2003.NET,这不是问题.

我有一个Windows服务项目,该项目使用我们必须连接到数据库的ODBC库.这就是奇怪开始发生的地方.无论出于何种原因,我都无法通过Windows 7中的服务与数据库(本地或网络上的)建立连接.在XP计算机上,它可以正常工作.

使用完全相同的库的其他应用程序也可以连接(本地或网络),但是由于任何原因,Windows 7中的服务都无法连接.使用的连接语句如下:

I recently moved my dev. environment from XP to windows 7 64 bit. We still need to use VS 2003.NET due to old library compatibility, which isn''t an issue.

I have a Windows Service project which uses an ODBC library we have to connect to a database. Here''s where the strange starts happening. For whatever reason, I am unable to get a connection to the database (local or on the network) via the service in windows 7. On an XP machine, it works just fine.

Other apps that use the exact same library are able to connect as well (local or network), but for whatever reason, the service in windows 7 cannot connect. The connection statement used is below:

sql_ret = SQLDriverConnect(m_sqlConn, NULL, (SQLCHAR*)m_szConnectParam.c_str(),
                            SQL_NTS, (SQLCHAR*)szConnectOutput, HUGE_STR,
                            &nResult,
                            SQL_DRIVER_NOPROMPT);



sql_ret返回为-1.没有其他错误或指示.同样,此相同的行也用于从Windows 7中的其他C ++对话框应用程序成功连接.

我也尝试了多个帐户(网络服务,管理员,本地帐户),但似乎无济于事.希望你能帮忙!

感谢



sql_ret comes back as -1. No other errors or indications are given. Again, this same exact line is used to successfully connect from other C++ dialog apps in Windows 7.

I have tried multiple accounts as well (networkservice, admin, local account) but nothing seems to work. Hope you can help!

Thanks

推荐答案

好吧,我想我尝试了除域帐户以外的所有登录.将服务设置为登录后,我就能够获得连接.

我想明确的解决方案是它从服务的登录问题.我不确定为什么目前只有域帐户在起作用,但是我有一个大致的指导.
Well, I guess I tried every login except my domain account. Setting the service to login as that, I was able to get the connection.

edit: I suppose the clear solution is that its a login issue from the service. I am not sure why only the domain account is working at this point, but I have a general direction.


这篇关于通过Windows Service(Win 7 x64)进行ODBC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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