Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Access Denied driving me nuts
Wed, Apr 9 2014 9:45 AMPermanent Link

John Taylor

The code below causes 11013 Access denied at Q.Prepare, while the one below
it does not, can anyone explain to me why ?
Using DBIsam 4.38 build 2.  Code is running in main thread, on a local
database


    Q := TDbIsamQuery.Create(nil);
    try
      Q.DatabaseName := AppDataPath;
      Q.Sql.Add('SELECT DISTINCT FOLDER FROM ' +
AnsiQuotedStr(MAIN_TABLENAME_INCOMING,'"'));
      Q.Prepare;
      Q.Open;
<snip>

    S := TDBIsamSession.Create(nil);
    Q := TDbIsamQuery.Create(nil);
    try
      S.AutoSessionName := true;
      Q.SessionName := S.SessionName;
      Q.DatabaseName := AppDataPath;
      Q.Sql.Add('SELECT DISTINCT FOLDER FROM ' +
AnsiQuotedStr(MAIN_TABLENAME_INCOMING,'"'));
      Q.Prepare;
      Q.Open;

I see Access Denied far too often for no apparent reason unless I am and
have been missing something very basic for a long time now Frown

JT
Wed, Apr 9 2014 11:22 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

John,

Are you using Client/Server of File Sharing, what version, and why did you try to set AutoSessionName to True, is there a precise reason? Also, in what kind of environment are you seeing this, is it at standalone app or networked, we do need more info on that.

--
Fernando Dias
[Team Elevate]
Wed, Apr 9 2014 12:52 PMPermanent Link

John Taylor

Standalone app , filesharing, single user no network involved at all.  As I
said previously Dbisam 4.38 build 2 with Delphi 2007, Windows 8.

What is the problem with setting AutoSessionName = true ?

The point I was trying to make was without a specific TDBIsamSession
assigned to the TDBIsamQuery, I get "Access Denied", with a specific session
assigned, no problem.

JT
"Fernando Dias" <fernandodiasAremovthis.easygate.com.pt> wrote in message
news:D6A7E47A-F754-41E1-9EB6-2D442DEB1384@news.elevatesoft.com...
> John,
>
> Are you using Client/Server of File Sharing, what version, and why did you
> try to set AutoSessionName to True, is there a precise reason? Also, in
> what kind of environment are you seeing this, is it at standalone app or
> networked, we do need more info on that.
>
> --
> Fernando Dias
> [Team Elevate]
Wed, Apr 9 2014 1:47 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

John,

AutoSessionName is only useful if your application a multi-threaded application and it needs to have unique session names for each thread at runtime. If that is not the case, you should set it to false.
The issue you are seeing is perhaps because your application doesn't have write permissions in the directory where it is creating the temporary files for the query. What have you set as PrivateDir?

--
Fernando Dias
[Team Elevate]
Wed, Apr 9 2014 2:56 PMPermanent Link

John Taylor

Write permissions is not the problem, nor is anti-virus software since there
is no anti-virus software installed on the machine in question.

The *only* thing I changed to get around the 'Access Denied' exception was
to add the Session as indicated in the second piece of code in the original
post.

To clarify the error message was 'Access Denied to table <numbered
table>.dat , ie a numbered canned result set table.  I did not set the
PrivateDir property so according to
the manual, that would default to local temporary directory for user,
however I do have the CreateTempTablesinDatabase property of the
DBIsamEngine component set to true.

John
"Fernando Dias" <fernandodiasAremovthis.easygate.com.pt> wrote in message
news:59A6F513-EE20-4E56-88EC-8683CFD083B3@news.elevatesoft.com...
> John,
>
> AutoSessionName is only useful if your application a multi-threaded
> application and it needs to have unique session names for each thread at
> runtime. If that is not the case, you should set it to false.
> The issue you are seeing is perhaps because your application doesn't have
> write permissions in the directory where it is creating the temporary
> files for the query. What have you set as PrivateDir?
>
> --
> Fernando Dias
> [Team Elevate]
Wed, Apr 9 2014 4:03 PMPermanent Link

Raul

Team Elevate Team Elevate

On 4/9/2014 2:56 PM, John Taylor wrote:
> To clarify the error message was 'Access Denied to table <numbered
> table>.dat , ie a numbered canned result set table.  I did not set the
> PrivateDir property so according to
> the manual, that would default to local temporary directory for user,
> however I do have the CreateTempTablesinDatabase property of the
> DBIsamEngine component set to true.

John,

CreateTempTablesinDatabase does not apply in this case since it's not a
table alter type of operation.

The issue is definitely with the PrivateDir since it's a temp numbered
table.

If you don't assign a session then default one is used so can you check
what the PrivaetDir setting actually is (i.e. session.PrivateDir ).

In my case it points to :  C:\Users\<login id>\AppData\Local\Temp and if
i run a the code you posted (first version with no session) then temp
table is created and everything works OK (no error, query prepare and
opens). Running 4.38 b1 here still though.

Raul
Mon, Apr 28 2014 11:06 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

John,

<< The code below causes 11013 Access denied at Q.Prepare, while the one
below it does not, can anyone explain to me why ? >>

What's the complete error message ?  Does it contain a numbered table name ?
If so, then the PrivateDir property setting for the default session is
pointing to a directory that you don't have permissions for.

<< I see Access Denied far too often for no apparent reason unless I am and
have been missing something very basic for a long time now Frown>>

If you're implying that something is wrong with DBISAM, then you're
incorrect.  These issues are *always* caused by improper directory settings,
permissions, or table files being open by the same process/other processes
that prevent access by the current process.

Tim Young
Elevate Software
www.elevatesoft.com

Image