0

The pagesize of the file I read is 32768. When i set the JET_paramDatabasePageSize to 32768,JetInit returns -1213.Then,i set the JET_paramRecovery to "Off",JetInit succeeds.But,when I use JetAttachDatabase,it returns -550.

Here is my code:

err=JetSetSystemParameter(&instance,sesid,JET_paramDatabasePageSize ,32768 ,NULL);  
err=JetCreateInstance(&instance,NULL);
err=JetSetSystemParameter(&instance,sesid,JET_paramRecovery,0,"Off");
err=JetInit(&instance);
err=JetBeginSession(instance,&sesid,NULL,NULL);
err=JetAttachDatabase(sesid,buffer, JET_bitDbReadOnly );
err=JetOpenDatabase  ( sesid, buffer, NULL, &dbid, JET_bitDbReadOnly );

What's wrong with it?I am running a Windows 7 32bit.

Android Developer
  • 987
  • 1
  • 8
  • 22
burning
  • 1
  • 1
  • It seems to work just fine -550 means: The database was not shutdown cleanly. A recovery must first be run to properly complete database operations for the previous shutdown. – Fotis MC Jul 12 '13 at 08:29
  • This means that the database was not shutdown cleanly and ESE won't allow you to open it up just like that. You can use the Esentutl provided by Microsoft to fix the database. – Fotis MC Jul 12 '13 at 08:36

1 Answers1

0

The page size is global to the process (NOT just the instance) and is persisted in the log files and the database, so changing the page size can be annoyingly tricky.

Is there information in the database that you're trying to access? Or did you just experience this during development?

If you saw this during development, then the easiest thing to do is to blow everything away (del .edb edb) [Assuming that you kept the prefix as "edb"].

Also, are you sure that the database is 32k pages? You can confirm with esentutl.exe -mh <database-name>.

It will be trickier to recover the data if you do care about, and you switched the page size. (I don't know off the top of my head, and I'd have to try a few things out...)

-martin

Martin Chisholm
  • 461
  • 2
  • 6