From: vijay singh on
Environment



Platform - VC 2005, Window server 2003, OleDB

Database - Oracle, Microsoft Access Database



Problem Statement



We have developed multithreaded service application which can run 24x7. I
have used two machines to run test. First machine (M1) on which service is
running.

Second machine (M2) on which Microsoft Access Database and half million text
file are placed. More than 20GB of disk space are available on both
machines.



Each worker thread uses technology for different purpose



OleDB - Read Microsoft Access database

CStdioFile - Open text file in readonly and share_deny_none mode to read
file content.

CStdioFile - Open text file in write mode to write data in a file.



Calling CoInitializeEx(NULL,COINIT_MULTITHREADED) and CoUninitialize() when
thread start and end respectively.



During overnight test we found errors



"Disk or network
- Access database error (This error occur when try to execute a
query)

"Disk full while accessing <File
- File error (This error occur when try to a close an opened file)

"An unknown error occurred while accessing <File Name>" - File
error (This error occur when try to read a character from an opened file)



Service is reporting database and file error at the same time i.e. if one
thread reports database error other three-four reports file error. Sequence
of error pattern is



1) Disk full while accessing <File
- file error (1st thread)

2) Disk or network
- database error (2nd thread)

3) An unknown error occurred while accessing <File Name> - file
error (3rd thread)

4) An unknown error occurred while accessing <File Name> - file
error (4th thread)

5) An unknown error occurred while accessing <File Name> - file
error (5th thread)

6) An unknown error occurred while accessing <File Name> - file
error (6th thread)



or



1) An unknown error occurred while accessing <File Name> - file
error

2) Disk full while accessing <File
- file error

3) Disk or network
- database error

4) An unknown error occurred while accessing <File Name> - file
error

5) An unknown error occurred while accessing <File Name> - file
error

6) An unknown error occurred while accessing <File Name> - file
error



or



1) An unknown error occurred while accessing <File Name> -file
error

2) An unknown error occurred while accessing <File Name> -file
error

3) An unknown error occurred while accessing <File Name> -file
error

4) Disk or network
-database error





Solution applied



At Database server (Machine M2)



a) NET CONFIG SERVER /AUTODISCONNECT:60

Default value is 15 min. This command will change to 1 hr i.e. 60 min.



At Production server (Machine M1)



b) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Jet
4.0\MaxBufferSize = 2048

Default value of MaxBufferSize is 0 now change it to 2048.



MaxBufferSize purpose - Microsoft Jet will read and write data in 2K pages.



c) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Jet 4.0\PageTimeout
= 60000

Default value is 5000 mili secs change it to 1 min i.e. 60000 mili secs.



PageTimeout purpose - When two applications are trying to gain access to the
same database, any data entered from the other user will not be updated for
one minute even after the code re-queries the database.



Result:



Frequency of error is less but still we are getting error.





Kindly please let me know someone has solution of mentioned issue.



Thanks in advance,



vijay