I have the following database, written in some variant of MS Access (it's an MDB file -- UNIX file
confirms this)
I'm trying to read the contents of from Javascript in Windows. Though, really, any tools would be fine. For example, Python would be fine as well... but I am trying to avoid VB6. Of course, I can cut some of the code there and run it in the IDE and I can extract the values. But I want to understand the underlying mechanisms
I am using a query from node-adobd
to select all the maps "Data" column. It's a string that was compressed via zlib (compression level unknown) and then shoved into a table.
In Node, using the following function I was able to make a query and get the underlying string stream...
75 0a 00 00 **78 01** 53 d5 20 ...
That's a ZLIB magic number which tipped me off. I tried using zlib
from Node to decompress it but it's failing with various errors. Those first 4 bytes are a header the game engine seems to append; but it has nothing to do with the payload from what I can tell (you can read the compression routine here.
Since it seems to read it in VB6 land without a problem without any other post processing from what I can tell (you can find it modDatabase
if you want to read it) all I can think of is: something is happening in the database connector or when I get the data. Something is being encoded without my consent, perhaps.
I query like such:
connection.query('Select Number, Data from [Maps]')
.then((results) => {
const result = results[0]; // first one to experiment with
// use the above code to construct a byte array from
// result.Data, but I have also tried things like
// Buffer.from ... but it asks about encodings
// which I am unsure of!
});
And I get the above signature in the case of getting raw bytes. Getting a buffer with another encoding has varying degrees of success. Viewing the raw data in DBeaver gives similar results depending on the encoding. However, to view it I have to pick an encoding.
My understanding is strings are stored simply as sequences of bytes in memory at the end of the day -- can I not get access to this from a low level? If not, how do you handle converting the encoding?
According to this page, Memo is Unicode (but it does not really say what) but it mentions two bytes, so probably UTF-16 assuming this is a relatively modern version of access...