JMcAllister
MIS
Does anyone know of anything that would cause an ADODB connection to choke when trying to run a script as a service on NT, with SRVANY?
I have a script that parses a file, extracting some data, then inserts this data into an Access 2000 database. The script works great when run manually, but it needs to run continuously, as the data is updated every 10 minutes, and I don't want to stay logged in on the system it is running on. So, I'm trying to get it to run as a service.
Here is the relevant portion of my code:
I've tried various connection strings with both DSN and DSN-less connections, again it works when run manually, but chokes as a service.
SRVANY is installed and the registry has been edited to call WSCRIPT as the Application (I also tried using CSCRIPT) and pass the script as the AppParameter. In the service, I'm using an account with admin privelege (and logon as service right).
When I start the service, the script runs but the DB connection does not get opened. I added some error handling to e-mail me the error and what I'm receiving is:
Error number -2147467259, Unspecified error
with DSN and DSN-less connections it is:
Error number -2147467259, [Microsoft][ODBC Microsoft Access Driver] Disk or network error.
I've run debug (with the //x option) as System, in interactive mode. oDB doesn't pickup the same connection string as it does when run manually (Extended Properties and so forth). Unfortunately, I can't get to the debug when running as the specified user (no interactive mode).
If anyone has done this before or would like to experiment with this, I would greatly appreciate any feedback or advice.
TIA,
~ jmcallister
I have a script that parses a file, extracting some data, then inserts this data into an Access 2000 database. The script works great when run manually, but it needs to run continuously, as the data is updated every 10 minutes, and I don't want to stay logged in on the system it is running on. So, I'm trying to get it to run as a service.
Here is the relevant portion of my code:
Code:
Set oDB = CreateObject("ADODB.Connection")
Set oRS = CreateObject("ADODB.Recordset")
oDB.Open "C:\pathto\database.mdb"
' All the following ad... keywords have been prev declared as const
oRS.Open "tblEth0", oDB, adOpenKeyset, adLockPessimistic, adCmdTable
oRS.AddNew aFlds, aData ' Arrays containing the fields and data
oRS.Update
oRS.Close
If oRS.State = adStateOpen Then
oRS.Close
End If
If oDB.State = adStateOpen Then
oDB.Close
End If
Set oRS = Nothing
Set oDB = Nothing
I've tried various connection strings with both DSN and DSN-less connections, again it works when run manually, but chokes as a service.
SRVANY is installed and the registry has been edited to call WSCRIPT as the Application (I also tried using CSCRIPT) and pass the script as the AppParameter. In the service, I'm using an account with admin privelege (and logon as service right).
When I start the service, the script runs but the DB connection does not get opened. I added some error handling to e-mail me the error and what I'm receiving is:
Error number -2147467259, Unspecified error
with DSN and DSN-less connections it is:
Error number -2147467259, [Microsoft][ODBC Microsoft Access Driver] Disk or network error.
I've run debug (with the //x option) as System, in interactive mode. oDB doesn't pickup the same connection string as it does when run manually (Extended Properties and so forth). Unfortunately, I can't get to the debug when running as the specified user (no interactive mode).
If anyone has done this before or would like to experiment with this, I would greatly appreciate any feedback or advice.
TIA,
~ jmcallister