Solved

Pervasive SQL error message

Posted on 2009-07-07
2
1,658 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
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now