Search code examples
entity-frameworkado.netodbcsqlanywheresybase-asa

Extract data from Sql Anywhere 5 .db file


I have to extract some data from some SqlAnywhere 5 .db files, which another system periodically extracts from the running db and saves.

I have installed on my machine the sql anywhere 16 suite.

I tried to connect to the db using plain ado.Net as written here: http://www.sybase.com/detail?id=1054947

SAConnection myConnection = new SAConnection(@"UID=guest;PWD=guest;DBF=D:\test\rotomat\3991194.db"); 
//EXPECTION: Unable to start specified database: 'D:\test\rotomat\3991194.db' was created by a different version of the software
myConnection.Open();

but I got that error you see as a comment.

So, I tried to convert the db to a newer version with the dbunload utility:dbunload - permission issues, but I got that error you see, regarding permissions. Googling it, it seems like you need to have DBA credentials (which I don't have) to be able to extract the db. Also tried "just the 'pieces' table" with the -t option, no results.

Also tried other things (odbc, 3rd parties drivers), no results.

What I'm asking is: is there a way to extract data from those .db files programmaticaly? Entity Framework would be a great plus.

Thanks


Solution

  • No. You can't run a database that old with a server newer than v10.0 without doing a reload, and you can't do a reload without being able to connect as user with DBA authority in that database. If you have a copy of SQL Anywhere version 5, you can use that but otherwise, there's no way to get the data out short of hex editing the database file itself and guessing at what's data and what's not.

    Disclaimer: I work for SAP in SQL Anywhere engineering.