• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Cfexecute and Access 2007

New Here ,
Nov 15, 2010 Nov 15, 2010

Copy link to clipboard

Copied

Hello All,

I am having trouble with some cf code.  Any help would be appreciated.

Here is my code:

<cfexecute name="C:\WINDOWS\system32\cmd.exe" arguments=" /c C:\inetpub\wwwroot\gisweb\mmd.bat" timeout="100"></cfexecute>

In the following batch file I have put line numbers just to help.  They are not in real file.  Here is the batch file it is calling:

1  "C:\Program Files (x86)\Microsoft Office\Office12\MSACCESS.exe" "D:\Data\SEDCAccess\NNPPDintegrator.mdb" /x Missed_Meters_Daily

2  REM Mapguide Missed Meters Daily to spatial SQLite

3  del /f /q "D:\Data\SEDCAccess\mmd.db"

4  "C:\Program Files (x86)\FWTools2.4.7\bin\ogr2ogr" -f "SQLITE" -dsco  FORMAT=WKB "D:\Data\SEDCAccess\mmd.db" "D:\Data\SEDCAccess\mmd.vrt"

5  REM SQLITE VIEW TO SHP
6  del /f /q "D:\Data\ShapeFiles\missedmd.dbf"
7  del /f /q "D:\Data\ShapeFiles\missedmd.idx"
8  del /f /q "D:\Data\ShapeFiles\missedmd.shp"
9  del /f /q "D:\Data\ShapeFiles\missedmd.shx"

10  "C:\Program Files (x86)\FWTools2.4.7\bin\ogr2ogr" -f "ESRI Shapefile" "D:\Data\ShapeFiles" "D:\Data\SEDCAccess\mmd.db"

The cfexecute works fine when I have line 1 rem'ed out.  It calls the batch file, and executes lines 2-10.  The whole batch file also runs fine when I run it from it's folder.

I can see under processes that cfexecute has started up and MSACCESS.EXE*32 under the administrator account, but it just hangs.

I am running this on a server 2008 64 bit machine with IIS7 installed.

It does not want to run the MSACCESS.EXE portion.  It seems to choke on it everytime.  Anyway to debug this, see what is going on behind the scene?  Any suggestions?

TOPICS
Advanced techniques

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 15, 2010 Nov 15, 2010

Copy link to clipboard

Copied

Things to check:

Does the Windows account that the CF server runs as have rights to:

1. Read/write the file D:\Data\SEDCAccess\NNPPDintegrator.mdb?

2. Execute the C:\Program Files (x86)\Microsoft Office\Office12\MSACCESS.exe program?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 15, 2010 Nov 15, 2010

Copy link to clipboard

Copied

Also is there any potential UI interaction that Access is expecting that CF can't negotiate, like some sort of dialogue being shown, which - whwn you run the batch file - you handle yourself (by clicking on something, etc).

Also it looks like the Access process itself generates some files.  Does the login you're using have permissions to do that (as you're saying it's starting as an admin user, I am guessing probably "yes").

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 15, 2010 Nov 15, 2010

Copy link to clipboard

Copied

I have gone into services and made all coldfusion services run as administrator.  I have also given full read/write access to administrators for these databases.  I have gone into cold fusion admin and set up a user with the exact same un/pw as the administrator on the server.  If I have missed something, please let me know.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 15, 2010 Nov 15, 2010

Copy link to clipboard

Copied

Has making these changes resolved the problem?

You might also consider running CF under a less privileged account and granting the account rights to the access program and files. Granting admin rights to a service is considered a bad practice. As a general rule accounts should only be granted sufficient rights to do the tasks they need to perform and no more.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 15, 2010 Nov 15, 2010

Copy link to clipboard

Copied

As a general rule accounts should only be granted sufficient rights to do the tasks they need to perform and no more.

Yeah, but whilst troubleshooting stuff like this, my first port of call would be to run as admin, to remove all doubt that it's a permissions thing.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 15, 2010 Nov 15, 2010

Copy link to clipboard

Copied

All proper permissions have been given that I can think to give.  In granting administrator access, I am just trying to narrow the problem down.  Then I can go back later and make it nice and secure.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 15, 2010 Nov 15, 2010

Copy link to clipboard

Copied

peelseel2 wrote:

All proper permissions have been given that I can think to give.  In granting administrator access, I am just trying to narrow the problem down.  Then I can go back later and make it nice and secure.

Good point.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Nov 15, 2010 Nov 15, 2010

Copy link to clipboard

Copied

The whole batch file also runs fine when I run it from it's folder

Just to be 100% sure we are on the same page: when _you_ ran the bat file manually you were logged in under the same account the CF Server is now using ie Administrator?

but it just hangs.

It is a long shot, but what version of CF are you running? Older versions (including CF8.0 I think ...) would sometimes hang when an error occurred because cfexecute did not capture the stderr stream. The windows fix was to redirect stderr to stdout ie add the command "2>&1".  It is worth a shot to see if it has any affect on the hanging issue.

        http://www.forta.com/blog/index.cfm/2006/9/11/a-couple-of-cfexecute-gotchas

Message was edited by: -==cfSearching==-

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 15, 2010 Nov 15, 2010

Copy link to clipboard

Copied

Also it may be worth having CF Login using the account you login as and

run the batch manually.

As their could be something in the profile which is required, which is

not in the Admin profile, as this has caught me in the past.

Just something else to try out.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 16, 2010 Nov 16, 2010

Copy link to clipboard

Copied

It appears to be some security issue.  I replicated the problem using psexec and getting into a remote interactive command prompt.  Trying the same batch file, which works fine locally, when I run it remotely it spawns the access process but nothing happens, just like what happens with cfexecute.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 16, 2010 Nov 16, 2010

Copy link to clipboard

Copied

You might investigate using the PsExec tool to execute batch files on a remote computer.  Note that I have not used this with CFEXECUTE.

http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 16, 2010 Nov 16, 2010

Copy link to clipboard

Copied

I investigated it to use it instead of cfexecute, but since it is displaying the same behavior as cfexecute, I

think it is a security issue on the server and nothing to do with psexec or cfexecute.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 18, 2010 Nov 18, 2010

Copy link to clipboard

Copied

LATEST

Well, we kinda figured it out.  The macro that we where calling in the Access DB was a make table query into another Access DB.  We changed the query to a make table query into the same DB and it worked.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation