> Thanks for the code you sent> But as I am new to all
> this I would like to know that do I have to <cfset>
> the "objectMDB" and "tempmdb".I am failing to
> understand your programm please help/.


O.K.

I'll try to be more helpful.

objectMDB is the access .mdb file you wish to
compact and repair. The value of the variable is the
full path to the .mdb file, e.g.
c:\db\thisAccessFile.mdb

tempMDB is likewise a full path for the
DAO code to use when creating the
compacted and repaired copy of objectMDB,
e.g.
c:\db\tempFile.mdb
tempFile.mdb doesn't exist until the DAO call
and will be renamed later by your code.

The method the DAO call follows is to
create a new copy of the file you wish to
compact and repair. It is up to you to rename
the tempMDB to your original filename after
deleting the objectMDB.

The call to the CF function
<cfset dropConnections = CFUSION_DBCONNECTIONS_FLUSH()>
is necessary as the cffile delete and rename actions will
fail if the the .mdb is locked (i.e in use).

In order to correctly assign the value of daoClass, look in
c:\Program Files\Common Files\Microsoft Shared\DAO\

You should see either dao360.dll or dao350.dll depending on
if you have Access2k or Access97 respectively.

Advice:
If you are going to schedule this, pick a time when
it is less likely the db is going to be in use as
CFUSION_DBCONNECTIONS_FLUSH() call
might interrupt a user session. I prefer to use a tool
I built to manually compress and repair any .mdb files
I happen to be using.

If you have any more questions, please feel free to ask.

Pan



> >
> > From: "monika kon" <[EMAIL PROTECTED]>
> > Subject: Automatic repair and compact
> >
> >
> > > Hi everyone,
> > > Is it possible to compact and repair Access
> > databbase
> > > every day automatically through Coldfusion
> > code.Please
> > > help!!
> > > Shally..
> >
> > Yes.
> > Acc97 DAO 3.5
> > Acc2k DAO 3.6
> >
> > DAO needs to be on the server - there are ADO
> > calls, but DAO seems better to me.
> >
> > The below script is the safest way I use.
> > You should wrap the below in a cftry/cfcatch trap.
> >
> > core script: modfy to your needs
> >   <cfset daoClass="DAO.DBEngine.36">
> > or,
> >   <cfset daoClass="DAO.DBEngine.35">
> >
> >
> > <CFOBJECT Action="create" name="DBEngine"
> > Class="#daoClass#">
> > <CFSET dummy=
> > DBEngine.CompactDatabase("#objectMDB#","#tempMDB#")>
> > <cfset dropConnections =
> > CFUSION_DBCONNECTIONS_FLUSH()>
> > <cffile action="delete"
> >  file="#objectMDB#">
> > <cffile action="rename"
> >   source="#tempMDB#"
> >   destination="#objectMDB#">
> >
> > Pan
> >
> >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to