Solved

Pervasive SQL error message

Posted on 2009-07-07
2
1,775 Views
Last Modified: 2013-12-25
I am receiving the following error from a CREATE PROCEDURE statement being executed through Pervasive.Data.SqlClient.Dll version 2.10.1.2 against WGE 9.6

The statement works fine on other DSNs, and has also worked fine on this DSN until today, super.

I really need to know why this is happening, and ideally how to prevent it from randomly appearing on client machines after deployment.

The exception is thrown on the "ExecuteNonQuery()" in my code snippit.

Pervasive.Data.SqlClient.PsqlException was caught
  ErrorPosition=0
  Message="Pervasive.Data.SqlClient.Lna.LnaException: [LNA][Pervasive][ODBC Engine Interface][Data Record Manager]Access to the requested file is denied(Btrieve Error 46)"
  Number=-4953
  Source="Pervasive.Data.SqlClient"
  SQLState="0"
  StackTrace:
       at Pervasive.Data.SqlClient.Lna.LnaObject.CheckError(LnaResponse res)
       at Pervasive.Data.SqlClient.Lna.LnaStatement.Execute(ParamInfoSet pis)
       at Pervasive.Data.SqlClient.PsqlCommandImpl.execute(Boolean parseOnly, CommandBehavior behavior, Boolean needReader)
       at Pervasive.Data.SqlClient.PsqlCommandImpl.doExecuteNonQuery()
       at DDInt.Common.CommonCommandImpl.ExecuteNonQuery()
       at Pervasive.Data.SqlClient.PsqlCommand.ExecuteNonQuery()
  InnerException:

Dim cmdCreateProc As Pervasive.Data.SqlClient.PsqlCommand = m_Connection.CreateCommand()
cmdCreateProc.CommandText = strSql
If cmdCreateProc.Connection.State <> ConnectionState.Open Then cmdCreateProc.Connection.Open()
cmdCreateProc.ExecuteNonQuery()

Open in new window

0
Comment
Question by:GeekHipster
2 Comments
 
LVL 18

Accepted Solution

by:
mirtheil earned 500 total points
ID: 24798350
The definition of a status 46:
46: Access to the requested file is denied

The MicroKernel returns this status code for the following reasons:

    * The application opened a file in Read-only mode and tried to perform a Write operation on that file.
    * The application attempted to perform a Write operation on a file that is flagged read-only by the operating system.
    * When the application opened the file, it did not correctly specify the owner name required for updates.
    * (Workgroup engine only) If a Workgroup engine user or task opens a file that a client machine has opened using a server MicroKernel, the MicroKernel returns this status code if the Workgroup engine user attempts to write to the file.
    * (9.x and higher engines only) The application attempted to perform a Write operation on a 5.x format file. When using a 9.x or higher engine, you cannot perform a write operation such as insert or delete on a 5.x format file.




If this is happening randomly, I would guess that some other process is locking one of the Pervasive files (since you're creating a procedure it is probably PROC.DDF).  Usually, this locking can be traced back to backup or anti-virus software.  Make sure you're not scanning the PSQL data files (including DDFs) with your AV when these errors occur.  
0
 
LVL 1

Author Comment

by:GeekHipster
ID: 24803482
This had to do with an elusive ReadOnly flag and a seemingly inconsistent existence of ~PVSW~.LOC file which was preventing my connections from recognizing that I had turned off the silly ReadOnly flag a hundred years ago!    :)

Anyway, turn off ReadOnlys, restart Pervasive Engine, life is good.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
null value 15 106
Update in Sql 7 38
Adding queries and macros to many Microsoft Access Databases. 7 86
Slow MySQL (InnoDB) Query with Inner Join & GroupBy 7 55
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question