HiveBrain v1.2.0
Get Started
← Back to all entries
snippetMinor

Unknown Db file format - best way to find out?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
formatfileunknownwayfindoutbest

Problem

A client has given me the data he wants visualised in my project - but I don't know what DB format it's in. He's pretty unclear, also..

I have access to the table structures, but don't know how to read it in. It's definitely not a flat file.

There are several files for each dataset:

  • file.dat (biggest by far)



  • file.id (small)



  • file.ind (half the size of *.dat)



The first few bytes in the *.dat file are 03 6E 02 14 14 15 19 00 (in case magic numbers are used).

Do these extensions ring any bells? Is there some software to determine the format?

Solution

If you are on a *nix system, you can try using the "strings" command on each file to peek at the contents. A header may give you a clue.

e.g.

strings file.dat | head


Here's an example run against a quicky sqlite3 database file.

~$ sqlite3 test.db
SQLite version 3.6.12
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table testtable (id INT);
sqlite> insert into testtable values (1);
sqlite> .quit
~$ strings test.db
SQLite format 3
Ktabletesttabletesttable
CREATE TABLE testtable (id INT)

Code Snippets

strings file.dat | head
~$ sqlite3 test.db
SQLite version 3.6.12
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table testtable (id INT);
sqlite> insert into testtable values (1);
sqlite> .quit
~$ strings test.db
SQLite format 3
Ktabletesttabletesttable
CREATE TABLE testtable (id INT)

Context

StackExchange Database Administrators Q#3674, answer score: 5

Revisions (0)

No revisions yet.