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  = orient.open("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?

Thanks

Hi @Enovyn

take a look here

http://orientdb.com/docs/3.0.x/java/Java-Multi-Threading.html

If you are using multiple session from the same thread

Let me know if this helps

Thanks

http://orientdb.com/docs/3.0.x/java/Java-Multi-Threading.html

1 Like

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

Have a nice day