Basically what I'm doing is
Step1. Deleting a working copy of an Access DB
Step2. Copying the live Access DB to the working area
Step3. Executing a stored procedure on a SQL DB that references the working copy of the Access DB
My code to do this in the prolog of a TI process is shown below.
Code: Select all
#Step 1 Step 1 Step 1 Step 1 Step 1 Step 1 Step 1 Step 1
#Step one duplicate the Access DB, the paths will be held in the server properties cube in the final version.
SourceFile = ' \\starst1p\Wayfarer\MDBinform160608\Live.mdb ';
Destn='\\starst1p\Wayfarer\CurrentMDB\';
DeleteDestn='\\starst1p\Wayfarer\CurrentMDB\Live.mdb';
BatchFileDelete='DeleteLiveAccess.bat ';
BatchFile='CopyLiveAccess.bat';
DatasourceASCIIQuoteCharacter='';
#Delete the access DB in the Destn directory if it exists
ASCIIOutput ('DeleteLiveAccess.bat','Erase ' | DeleteDestn);
ExecuteCommand ( 'DeleteLiveAccess.bat' , 1);
#EOF File Deletion
#Create the batch file in the data directory
#Step 2 Step 2 Step 2 Step 2 Step 2 Step 2 Step 2 Step 2
ASCIIOutput ('CopyLiveAccess.bat','XCopy %1 %2 /R /Y');
ExecuteCommand ( BatchFile | SourceFile | Destn, 1);
#File should now be copied across
#Step 3 Step 3 Step 3 Step 3 Step 3 Step 3 Step 3 Step 3
#Open ODBC connection to InformSQL and launch the stored procedure to refresh InformSQL from InformAccess
Source='InformSQL';
ClientName='TM1User';
Password='';
SQLQuery='Exec spUpdateMaxKey';
ODBCOpen(Source, ClientName, Password);
ODBCOutput(Source, SQLQuery);
ODBCClose(Source);
When the ODBCOpen tries to execute I get "Unable to open data source: "InformSQL"" and the process aborts. Now I could sort of understand this if the ODBC connection was pointing at the loaction of the access DB, but it isn't it points at a SQL DB.
I’ve tried putting “dummy†code between steps 2 and 3 getting the same error.
I've tested putting step 3 in the epilog and get the same error.
I’ve tried putting step 3 in a separate TI and calling it from the end of the prolog and get the same error.
I’ve tried putting step 3 in a separate TI and calling it from the end of the epilog and get the same error.
I’ve tried putting the two TIs processes (1 for step1 and 2, another for step 3) and calling them in sequence using a chore, getting the same error.
I’m happy that the code and logic is correct since if I launch the TIs manually then everything works as expected. I have noticed though that it takes a long time after I press the OK button from the first process executed successfully message for control to return to the server explorer.
My best guess of what is going on is that the server is still busy from the file copy (its>1gig), even though the 1 flag in Execute Process is supposed to make the TI wait until the copy is finished.
Anyway does anyone have an idea of what is causing this to fail or how I can work around it? I really need to schedule this up as an overnight process.
Cheers