Problem with multiple database instances

Hello everyone,

I wrote a class in Java which implements the OrientDB API and can execute a few queries. In this class, I also set up the connection to the database:

OrientDB orient = new OrientDB("remote:localhost", "root", %password%, OrientDBConfig.defaultConfig());
ODatabaseSession db  ="SwFw", "admin", "admin");

Now I want to use my OrientDB class in another class, where I create multiple instances of the OrientDB class. Then, when i execute methods form my OrientDB class, which perform different search queries, I sometimes get the error

The current database instance(com.orientechnologies.orient.core.db.document.ODatabaseDocumentRemote@4c7120a4) is not active on the current thread

If I execute the function again, it works. Is there any way to prevent this?


Hi @Enovyn

take a look here

If you are using multiple session from the same thread

Let me know if this helps


1 Like

Hey @wolf4ood,
thanks for your help, it works fine now.

Have a nice day