I am building a simple desktop-based command-line analysis tool for a set of .SDF files that were collected on various mobile devices for a research project. Unfortunately, I am having issues connecting to these .SDF files (each of which are stored locally on my desktop hard drive). The problem seems to be that the version of SQL Compact Edition used on the mobile devices is different from the one I have installed on my desktop.
First, when connecting to one of the .SDF files from my desktop analysis tool, I receive the exception:
System.Data.SqlServerCe.SqlCeInvalidDatabaseFormatException was unhandled Message="The database file has been created by an earlier version of SQL Server Compact. Please upgrade using SqlCeEngine.Upgrade() method." Source="SQL Server Compact ADO.NET Data Provider"
I now catch this exception and call the recommended SqlCeEngine.Upgrade() method, so my code looks like this:
The SqlCeEngine.Upgrade() calls takes about one minute, afterwards it throws a very confusing exception:
System.Data.SqlServerCe.SqlCeException was unhandled Message="The operation completed successfully." Source="SQL Server Compact ADO.NET Data Provider"
At first I thought I should just catch this exception and carry on normally (as the exception says that the operation did indeed complete successfully); however, after some experimentation I noticed that the new, upgraded .SDF file built by the Upgrade() command is automatically deleted right before this exception is thrown so there is no upgraded .SDF file to connect to. Thus, it appears that the SqlCeException is valid but that the message is just wrong. I have attempted to use both the SqlCeEngine.Upgrade() call (which upgrades the database in place) and the SqlCeEngine.Upgrade(newConnectionString) call (which makes a new database). Both fail with the same exception.
Any help here would be most appreciated. Has anyone else encountered this error?
I'd agree from your description that probably the exception is right and the message is wrong. Is it possible that some of the SDF files were created with a newer version of SQL Compact? Which version are you using?
Here's one way to find out what version of the files you're working with:
>I am building a simple desktop-based command-line analysis tool for a > set of .SDF files that were collected on various mobile devices for a > research project. Unfortunately, I am having issues connecting to > these .SDF files (each of which are stored locally on my desktop hard > drive). The problem seems to be that the version of SQL Compact > Edition used on the mobile devices is different from the one I have > installed on my desktop.
> First, when connecting to one of the .SDF files from my desktop > analysis tool, I receive the exception:
> System.Data.SqlServerCe.SqlCeInvalidDatabaseFormatException was > unhandled > Message="The database file has been created by an earlier version of > SQL Server Compact. Please upgrade using SqlCeEngine.Upgrade() > method." > Source="SQL Server Compact ADO.NET Data Provider"
> I now catch this exception and call the recommended > SqlCeEngine.Upgrade() method, so my code looks like this:
> The SqlCeEngine.Upgrade() calls takes about one minute, afterwards it > throws a very confusing exception:
> System.Data.SqlServerCe.SqlCeException was unhandled > Message="The operation completed successfully." > Source="SQL Server Compact ADO.NET Data Provider"
> At first I thought I should just catch this exception and carry on > normally (as the exception says that the operation did indeed complete > successfully); however, after some experimentation I noticed that the > new, upgraded .SDF file built by the Upgrade() command is > automatically deleted right before this exception is thrown so there > is no upgraded .SDF file to connect to. Thus, it appears that the > SqlCeException is valid but that the message is just wrong. I have > attempted to use both the SqlCeEngine.Upgrade() call (which upgrades > the database in place) and the > SqlCeEngine.Upgrade(newConnectionString) call (which makes a new > database). Both fail with the same exception.
> Any help here would be most appreciated. Has anyone else encountered > this error?
I don't know what this group would do without you :) I believe the SQL Compact Edition version used on the mobile devices was 3.1, however, my desktop is using 3.5. The work around I am now using is to configure my desktop app to use the 3.1 SQL CE libraries as well. I have experienced no problems since making the switch; however, I still think that SqlCeException message I received should probably be investigated by an MS dev.
> I'd agree from your description that probably the exception is right and the > message is wrong. Is it possible that some of the SDF files were created > with a newer version of SQL Compact? Which version are you using?
> Here's one way to find out what version of the files you're working with:
> >I am building a simple desktop-based command-line analysis tool for a > > set of .SDF files that were collected on various mobile devices for a > > research project. Unfortunately, I am having issues connecting to > > these .SDF files (each of which are stored locally on my desktop hard > > drive). The problem seems to be that the version of SQL Compact > > Edition used on the mobile devices is different from the one I have > > installed on my desktop.
> > First, when connecting to one of the .SDF files from my desktop > > analysis tool, I receive the exception:
> > System.Data.SqlServerCe.SqlCeInvalidDatabaseFormatException was > > unhandled > > Message="The database file has been created by an earlier version of > > SQL Server Compact. Please upgrade using SqlCeEngine.Upgrade() > > method." > > Source="SQL Server Compact ADO.NET Data Provider"
> > I now catch this exception and call the recommended > > SqlCeEngine.Upgrade() method, so my code looks like this:
> > The SqlCeEngine.Upgrade() calls takes about one minute, afterwards it > > throws a very confusing exception:
> > System.Data.SqlServerCe.SqlCeException was unhandled > > Message="The operation completed successfully." > > Source="SQL Server Compact ADO.NET Data Provider"
> > At first I thought I should just catch this exception and carry on > > normally (as the exception says that the operation did indeed complete > > successfully); however, after some experimentation I noticed that the > > new, upgraded .SDF file built by the Upgrade() command is > > automatically deleted right before this exception is thrown so there > > is no upgraded .SDF file to connect to. Thus, it appears that the > > SqlCeException is valid but that the message is just wrong. I have > > attempted to use both the SqlCeEngine.Upgrade() call (which upgrades > > the database in place) and the > > SqlCeEngine.Upgrade(newConnectionString) call (which makes a new > > database). Both fail with the same exception.
> > Any help here would be most appreciated. Has anyone else encountered > > this error?
Thanks for the follow up, Jon. I'll make sure the team is aware of the message if that's still what happens with 3.5 sp1 beta - I haven't tried it yet.
Ginny
"jonfroehlich" <jonfroehl...@gmail.com> wrote in message
I don't know what this group would do without you :) I believe the SQL Compact Edition version used on the mobile devices was 3.1, however, my desktop is using 3.5. The work around I am now using is to configure my desktop app to use the 3.1 SQL CE libraries as well. I have experienced no problems since making the switch; however, I still think that SqlCeException message I received should probably be investigated by an MS dev.
> I'd agree from your description that probably the exception is right and > the > message is wrong. Is it possible that some of the SDF files were created > with a newer version of SQL Compact? Which version are you using?
> Here's one way to find out what version of the files you're working with:
> >I am building a simple desktop-based command-line analysis tool for a > > set of .SDF files that were collected on various mobile devices for a > > research project. Unfortunately, I am having issues connecting to > > these .SDF files (each of which are stored locally on my desktop hard > > drive). The problem seems to be that the version of SQL Compact > > Edition used on the mobile devices is different from the one I have > > installed on my desktop.
> > First, when connecting to one of the .SDF files from my desktop > > analysis tool, I receive the exception:
> > System.Data.SqlServerCe.SqlCeInvalidDatabaseFormatException was > > unhandled > > Message="The database file has been created by an earlier version of > > SQL Server Compact. Please upgrade using SqlCeEngine.Upgrade() > > method." > > Source="SQL Server Compact ADO.NET Data Provider"
> > I now catch this exception and call the recommended > > SqlCeEngine.Upgrade() method, so my code looks like this:
> > The SqlCeEngine.Upgrade() calls takes about one minute, afterwards it > > throws a very confusing exception:
> > System.Data.SqlServerCe.SqlCeException was unhandled > > Message="The operation completed successfully." > > Source="SQL Server Compact ADO.NET Data Provider"
> > At first I thought I should just catch this exception and carry on > > normally (as the exception says that the operation did indeed complete > > successfully); however, after some experimentation I noticed that the > > new, upgraded .SDF file built by the Upgrade() command is > > automatically deleted right before this exception is thrown so there > > is no upgraded .SDF file to connect to. Thus, it appears that the > > SqlCeException is valid but that the message is just wrong. I have > > attempted to use both the SqlCeEngine.Upgrade() call (which upgrades > > the database in place) and the > > SqlCeEngine.Upgrade(newConnectionString) call (which makes a new > > database). Both fail with the same exception.
> > Any help here would be most appreciated. Has anyone else encountered > > this error?
I don't know what this group would do without you :) I believe the SQL Compact Edition version used on the mobile devices was 3.1, however, my desktop is using 3.5. The work around I am now using is to configure my desktop app to use the 3.1 SQL CE libraries as well. I have experienced no problems since making the switch; however, I still think that SqlCeException message I received should probably be investigated by an MS dev.
> I'd agree from your description that probably the exception is right and > the > message is wrong. Is it possible that some of the SDF files were created > with a newer version of SQL Compact? Which version are you using?
> Here's one way to find out what version of the files you're working with:
> >I am building a simple desktop-based command-line analysis tool for a > > set of .SDF files that were collected on various mobile devices for a > > research project. Unfortunately, I am having issues connecting to > > these .SDF files (each of which are stored locally on my desktop hard > > drive). The problem seems to be that the version of SQL Compact > > Edition used on the mobile devices is different from the one I have > > installed on my desktop.
> > First, when connecting to one of the .SDF files from my desktop > > analysis tool, I receive the exception:
> > System.Data.SqlServerCe.SqlCeInvalidDatabaseFormatException was > > unhandled > > Message="The database file has been created by an earlier version of > > SQL Server Compact. Please upgrade using SqlCeEngine.Upgrade() > > method." > > Source="SQL Server Compact ADO.NET Data Provider"
> > I now catch this exception and call the recommended > > SqlCeEngine.Upgrade() method, so my code looks like this:
> > The SqlCeEngine.Upgrade() calls takes about one minute, afterwards it > > throws a very confusing exception:
> > System.Data.SqlServerCe.SqlCeException was unhandled > > Message="The operation completed successfully." > > Source="SQL Server Compact ADO.NET Data Provider"
> > At first I thought I should just catch this exception and carry on > > normally (as the exception says that the operation did indeed complete > > successfully); however, after some experimentation I noticed that the > > new, upgraded .SDF file built by the Upgrade() command is > > automatically deleted right before this exception is thrown so there > > is no upgraded .SDF file to connect to. Thus, it appears that the > > SqlCeException is valid but that the message is just wrong. I have > > attempted to use both the SqlCeEngine.Upgrade() call (which upgrades > > the database in place) and the > > SqlCeEngine.Upgrade(newConnectionString) call (which makes a new > > database). Both fail with the same exception.
> > Any help here would be most appreciated. Has anyone else encountered > > this error?
I am a developer in SQL Server Compact Team and we definitely want to look at this issue in much deeper. Though I can not guarrenty I can get a fix for you in v3.5 SP1 RTM (It is internally went to RTM already); it would still be important for us to find the root cause. Once we confirm that there is indeed a bug in the code, you can get the fix by going thru normal support channel if required (free of cost).
> I don't know what this group would do without you :) I believe the SQL > Compact Edition version used on the mobile devices was 3.1, however, > my desktop is using 3.5. The work around I am now using is to > configure my desktop app to use the 3.1 SQL CE libraries as well. I > have experienced no problems since making the switch; however, I still > think that SqlCeException message I received should probably be > investigated by an MS dev.
> The full write-up and workaround is posted here:
>> I'd agree from your description that probably the exception is right and >> the >> message is wrong. Is it possible that some of the SDF files were created >> with a newer version of SQL Compact? Which version are you using?
>> Here's one way to find out what version of the files you're working with:
>> >I am building a simple desktop-based command-line analysis tool for a >> > set of .SDF files that were collected on various mobile devices for a >> > research project. Unfortunately, I am having issues connecting to >> > these .SDF files (each of which are stored locally on my desktop hard >> > drive). The problem seems to be that the version of SQL Compact >> > Edition used on the mobile devices is different from the one I have >> > installed on my desktop.
>> > First, when connecting to one of the .SDF files from my desktop >> > analysis tool, I receive the exception:
>> > System.Data.SqlServerCe.SqlCeInvalidDatabaseFormatException was >> > unhandled >> > Message="The database file has been created by an earlier version of >> > SQL Server Compact. Please upgrade using SqlCeEngine.Upgrade() >> > method." >> > Source="SQL Server Compact ADO.NET Data Provider"
>> > I now catch this exception and call the recommended >> > SqlCeEngine.Upgrade() method, so my code looks like this:
>> > The SqlCeEngine.Upgrade() calls takes about one minute, afterwards it >> > throws a very confusing exception:
>> > System.Data.SqlServerCe.SqlCeException was unhandled >> > Message="The operation completed successfully." >> > Source="SQL Server Compact ADO.NET Data Provider"
>> > At first I thought I should just catch this exception and carry on >> > normally (as the exception says that the operation did indeed complete >> > successfully); however, after some experimentation I noticed that the >> > new, upgraded .SDF file built by the Upgrade() command is >> > automatically deleted right before this exception is thrown so there >> > is no upgraded .SDF file to connect to. Thus, it appears that the >> > SqlCeException is valid but that the message is just wrong. I have >> > attempted to use both the SqlCeEngine.Upgrade() call (which upgrades >> > the database in place) and the >> > SqlCeEngine.Upgrade(newConnectionString) call (which makes a new >> > database). Both fail with the same exception.
>> > Any help here would be most appreciated. Has anyone else encountered >> > this error?
> I am a developer in SQL Server Compact Team and we definitely want to look > at this issue in much deeper. Though I can not guarrenty I can get a fix > for you in v3.5 SP1 RTM (It is internally went to RTM already); it would > still be important for us to find the root cause. Once we confirm that > there is indeed a bug in the code, you can get the fix by going thru > normal support channel if required (free of cost).
>> I don't know what this group would do without you :) I believe the SQL >> Compact Edition version used on the mobile devices was 3.1, however, >> my desktop is using 3.5. The work around I am now using is to >> configure my desktop app to use the 3.1 SQL CE libraries as well. I >> have experienced no problems since making the switch; however, I still >> think that SqlCeException message I received should probably be >> investigated by an MS dev.
>> The full write-up and workaround is posted here:
>>> I'd agree from your description that probably the exception is right and >>> the >>> message is wrong. Is it possible that some of the SDF files were created >>> with a newer version of SQL Compact? Which version are you using?
>>> Here's one way to find out what version of the files you're working >>> with:
>>> >I am building a simple desktop-based command-line analysis tool for a >>> > set of .SDF files that were collected on various mobile devices for a >>> > research project. Unfortunately, I am having issues connecting to >>> > these .SDF files (each of which are stored locally on my desktop hard >>> > drive). The problem seems to be that the version of SQL Compact >>> > Edition used on the mobile devices is different from the one I have >>> > installed on my desktop.
>>> > First, when connecting to one of the .SDF files from my desktop >>> > analysis tool, I receive the exception:
>>> > System.Data.SqlServerCe.SqlCeInvalidDatabaseFormatException was >>> > unhandled >>> > Message="The database file has been created by an earlier version of >>> > SQL Server Compact. Please upgrade using SqlCeEngine.Upgrade() >>> > method." >>> > Source="SQL Server Compact ADO.NET Data Provider"
>>> > I now catch this exception and call the recommended >>> > SqlCeEngine.Upgrade() method, so my code looks like this:
>>> > The SqlCeEngine.Upgrade() calls takes about one minute, afterwards it >>> > throws a very confusing exception:
>>> > System.Data.SqlServerCe.SqlCeException was unhandled >>> > Message="The operation completed successfully." >>> > Source="SQL Server Compact ADO.NET Data Provider"
>>> > At first I thought I should just catch this exception and carry on >>> > normally (as the exception says that the operation did indeed complete >>> > successfully); however, after some experimentation I noticed that the >>> > new, upgraded .SDF file built by the Upgrade() command is >>> > automatically deleted right before this exception is thrown so there >>> > is no upgraded .SDF file to connect to. Thus, it appears that the >>> > SqlCeException is valid but that the message is just wrong. I have >>> > attempted to use both the SqlCeEngine.Upgrade() call (which upgrades >>> > the database in place) and the >>> > SqlCeEngine.Upgrade(newConnectionString) call (which makes a new >>> > database). Both fail with the same exception.
>>> > Any help here would be most appreciated. Has anyone else encountered >>> > this error?
Jon seems to have reproduced it with a particular database. So it is highly likely that you are not able to reproduce the same issue with your set of databases. I want to get hold of that particular database to really see which combination of on-disk pages causes this issue. If you happen to have got the copy please post it.
Thanks, Laxmi [Disclaimer: All postings are as-is and confer no rights]
>> I am a developer in SQL Server Compact Team and we definitely want to >> look at this issue in much deeper. Though I can not guarrenty I can get >> a fix for you in v3.5 SP1 RTM (It is internally went to RTM already); it >> would still be important for us to find the root cause. Once we confirm >> that there is indeed a bug in the code, you can get the fix by going thru >> normal support channel if required (free of cost).
>>> I don't know what this group would do without you :) I believe the SQL >>> Compact Edition version used on the mobile devices was 3.1, however, >>> my desktop is using 3.5. The work around I am now using is to >>> configure my desktop app to use the 3.1 SQL CE libraries as well. I >>> have experienced no problems since making the switch; however, I still >>> think that SqlCeException message I received should probably be >>> investigated by an MS dev.
>>> The full write-up and workaround is posted here:
>>>> I'd agree from your description that probably the exception is right >>>> and the >>>> message is wrong. Is it possible that some of the SDF files were >>>> created >>>> with a newer version of SQL Compact? Which version are you using?
>>>> Here's one way to find out what version of the files you're working >>>> with:
>>>> >I am building a simple desktop-based command-line analysis tool for a >>>> > set of .SDF files that were collected on various mobile devices for a >>>> > research project. Unfortunately, I am having issues connecting to >>>> > these .SDF files (each of which are stored locally on my desktop hard >>>> > drive). The problem seems to be that the version of SQL Compact >>>> > Edition used on the mobile devices is different from the one I have >>>> > installed on my desktop.
>>>> > First, when connecting to one of the .SDF files from my desktop >>>> > analysis tool, I receive the exception:
>>>> > System.Data.SqlServerCe.SqlCeInvalidDatabaseFormatException was >>>> > unhandled >>>> > Message="The database file has been created by an earlier version of >>>> > SQL Server Compact. Please upgrade using SqlCeEngine.Upgrade() >>>> > method." >>>> > Source="SQL Server Compact ADO.NET Data Provider"
>>>> > I now catch this exception and call the recommended >>>> > SqlCeEngine.Upgrade() method, so my code looks like this:
>>>> > The SqlCeEngine.Upgrade() calls takes about one minute, afterwards it >>>> > throws a very confusing exception:
>>>> > System.Data.SqlServerCe.SqlCeException was unhandled >>>> > Message="The operation completed successfully." >>>> > Source="SQL Server Compact ADO.NET Data Provider"
>>>> > At first I thought I should just catch this exception and carry on >>>> > normally (as the exception says that the operation did indeed >>>> > complete >>>> > successfully); however, after some experimentation I noticed that the >>>> > new, upgraded .SDF file built by the Upgrade() command is >>>> > automatically deleted right before this exception is thrown so there >>>> > is no upgraded .SDF file to connect to. Thus, it appears that the >>>> > SqlCeException is valid but that the message is just wrong. I have >>>> > attempted to use both the SqlCeEngine.Upgrade() call (which upgrades >>>> > the database in place) and the >>>> > SqlCeEngine.Upgrade(newConnectionString) call (which makes a new >>>> > database). Both fail with the same exception.
>>>> > Any help here would be most appreciated. Has anyone else encountered >>>> > this error?