0 votes
asked in MicroStream for Java by (1k points)

I have some questions about initiating a connection to a datastore. The datastore itself usually isn't password protected, as it is part of the applications job to encrypt data if needed (or maybe network security...). So in general it should always be possible to connect to any datastore as long as I have physical access, right?

So what if I am trying to write a tool (as I am doing right now) that wants to connect to a datastore that wasn't generated from my tool but an external application. Lets say the path to the datastore is given and known (e.g. microstream/exampleApp). What I may NOT know is, how this datastore was configured initially. I could find out how many channels were configured by counting the sub folders (channel_0, channel....). But what about all the other configuration options? My concrete question is, what happens to the datastore if I connect to it in a different way than the way it was created? A mysql database doesnt care, where the create scripts were initially called from or what kind of configuration was done to the mysql server. Any mysql tool can access the mysql db. How does microstream work here?  What I want to prevent is that the datastore gets changed by a "different" connection configuration. Can I connect via only one channel to a previously configured datastore with several channels or maybe a different ....foundation/storageManager... ?

Thanks in advance :)

2 Answers

0 votes
answered by (3.4k points)
selected by
Best answer

Hello Fred,


The Microstream storages are not intended to be shared between different applications directly.
Loading a storage created by another application is possible but requires caution in case of different configurations.

Basically, you can load any storage if the files (type dictionary and channel files) can be accessed with read AND write permissions and you use a matching configuration.

Loading a storage with an unknown configuration is risky as it is possible to configure nearly everything, e.g. storing and loading behaviors for individual types. Loading a storage and working with the wrong configuration may cause various problems up to data lose.

Therefore, I strongly recommend loading only storages with known configurations.

The startup/loading itself will not change the stored data. If an error occurs during loading the stored data will not be affected.

But there are features that may prevent loading the storage if they are no more configured
e.g. https://manual.docs.microstream.one/data-store/customizing/custom-type-handler.
Others are intended to take effect after loading a storage with those features added to the configuration as https://manual.docs.microstream.one/data-store/legacy-type-mapping does.

After the storage has been loaded things may become complicated.
As long as nothing gets stored the stored data are not changed, but the storage files may be changed by the housekeeping (see https://manual.docs.microstream.one/data-store/housekeeping).

Far more dangerous e.g. are custom type handlers and legacy type mappings that may be applied if objects are stored (new ones or updated)


Microstream and (SQL) Databases are quite different.

Microstream is embedded into your application it works directly within your application. The way to “connect” to Microstream is to create or load a storage. Loading will be done by Microstream as soon as you call the EmbeddedStorageManager.start() method. If storage files are found Microstream will load the stored data, otherwise it will create an empty storage.

The Microstream channels are not connections from Microstream into the user code, they are I/O channels Microstream uses internally to store and load data. The more channels you configure the more parallel I/O task will be used internally. If more then one channel is configured Microstream will try to distribute the stored entity evenly across those channels. Therefore it is not possible to change the channel count or even read from a subset of those channels.


Best regards

0 votes
answered by (1k points)
I know you have to have access to the data model. That's where URLClassLoader comes into play. But do the other configurations matter when connecting? If so, which?
Notes: Every question must be a separate forum post. Headline: Formulate your question shortly and precisely. Thank you!
Powered by Question2Answer