Home » Infrastructure » Windows » Oracle service starting through appln (Oracle 9.2i, Windows 2000, Visual studio 6.0)
Oracle service starting through appln [message #314273] Wed, 16 April 2008 04:51 Go to next message
sgkharvi
Messages: 1
Registered: January 2008
Location: india
Junior Member
hi,
in our application we have to block the windows access to users. so we r starting our application by running our application by shell command. since our appln uses oracle database and need to connect database in the beginning we are starting the oracle service using SCManger database,
this was working fine till we had administrator privilages. but now the user login is only member of USER group and after this OpenSCManger is not returning service control Manager database handle and we are not able to start our appln.

the code is as follows:
BOOL bServiceStart = FALSE;
while(!bServiceStart)
{
SERVICE_STATUS ssStatus;
DWORD dwOldCheckPoint;
SC_HANDLE schSCManager = OpenSCManager(
NULL, // local machine
NULL, // ServicesActive database
SC_MANAGER_ALL_ACCESS); // full access rights

if (schSCManager == NULL)
{
AfxMessageBox("Error OpenSCManager");
break;
}
SC_HANDLE schService = OpenService(
schSCManager, // SCM database
TEXT("OracleServiceXXX"), // service name
SERVICE_ALL_ACCESS);
if (schService == NULL)
{
OutputDebugString("Oracle: ERROR StartService\n");
break;
}
if (!StartService(
schService, // handle to service
0, // number of arguments
NULL) ) // no arguments
{
OutputDebugString("Oracle: Error StartService");
}
else
{
OutputDebugString("Oracle: Oracle Service starting\n");
}
// Check the status until the service is no longer start pending.
if (!QueryServiceStatus(
schService, // handle to service
&ssStatus) ) // address of status information
AfxMessageBox("Error QueryServiceStatus");
while (ssStatus.dwCurrentState == SERVICE_START_PENDING)
{
// Save the current checkpoint.
dwOldCheckPoint = ssStatus.dwCheckPoint;
// Wait for the specified interval.
Sleep(ssStatus.dwWaitHint);
// Check the status again.
if (!QueryServiceStatus(
schService, // handle to service
&ssStatus) ) // address of status information
break;
// Break if the checkpoint has not been incremented.
if (dwOldCheckPoint >= ssStatus.dwCheckPoint)
break;
}
if (ssStatus.dwCurrentState == SERVICE_RUNNING)
{
OutputDebugString("Oracle: Oracle Service is started \n");
bServiceStart = TRUE;
}
else
{
OutputDebugString("Oracle: ERROR StartService\n");
}

CloseServiceHandle(schService);
}
return bServiceStart;

is there any other method to start service for USER group login
kindly someone help us out??????????

thanks
Re: Oracle service starting through appln [message #314283 is a reply to message #314273] Wed, 16 April 2008 05:09 Go to previous message
Michel Cadot
Messages: 58529
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Kindly read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.

Kindly post Oracle question.
Kindly post in the approriate forum, isn't this a Windows question?

Regards
Michel

[Updated on: Wed, 16 April 2008 05:10]

Report message to a moderator

Previous Topic: Oracle patch 9.2.0.6 for client on vista
Next Topic: 10.2.0.3 patchset
Goto Forum:
  


Current Time: Thu Jul 24 10:44:54 CDT 2014

Total time taken to generate the page: 0.48190 seconds