windows服务中如何使用oracle数据库

captain_x 2007-11-21 04:26:18
rt
自己写的windows服务每次都比oracle数据库先启动,于是读数据库就失败,有没有什么好的方法?
...全文
58 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
captain_x 2007-11-22
  • 打赏
  • 举报
回复
已经搞定了,原来是oracle没有启动成功的时候我自己的程序连接不上,于是自己弹出一个odbc数据源对话框,由于是一个服务程序,所以对话框也不显示,但程序就停止在这里了,在CDatabase::openex函数中使用CDatabase::noOdbcDialog参数就可以了
captain_x 2007-11-22
  • 打赏
  • 举报
回复
这样不行,我本来都已经设置了lpDependencies了,不知道为什么连接不了数据库
我用的是CDatabase类,数据库是oracle
dyw 2007-11-21
  • 打赏
  • 举报
回复
SC_HANDLE WINAPI CreateService(
__in SC_HANDLE hSCManager,
__in LPCTSTR lpServiceName,
__in_opt LPCTSTR lpDisplayName,
__in DWORD dwDesiredAccess,
__in DWORD dwServiceType,
__in DWORD dwStartType,
__in DWORD dwErrorControl,
__in_opt LPCTSTR lpBinaryPathName,
__in_opt LPCTSTR lpLoadOrderGroup,
__out_opt LPDWORD lpdwTagId,
__in_opt LPCTSTR lpDependencies, // see this member
__in_opt LPCTSTR lpServiceStartName,
__in_opt LPCTSTR lpPassword
);


lpDependencies

A pointer to a double null-terminated array of null-separated names of services or load ordering groups
that the system must start before this service. Specify NULL or an empty string if the service has no dependencies.
Dependency on a group means that this service can run if at least one member of the group is running after an
attempt to start all members of the group.

You must prefix group names with SC_GROUP_IDENTIFIER so that they can be distinguished from a service name,
because services and service groups share the same name space.
eduyu 2007-11-21
  • 打赏
  • 举报
回复
LoadOrderGroup
LoadOrderGroupDependencies
zhoujianhei 2007-11-21
  • 打赏
  • 举报
回复
每个N秒重连一次,次过程重复M次。应该可以了。
lucian2007 2007-11-21
  • 打赏
  • 举报
回复
最简单的方法是让你的服务sleep一下,等数据库启动了在唤醒!!

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧