OrientDB with tomcat DB locking issue

135 views
Skip to first unread message

Kareem Jabr

unread,
Aug 11, 2014, 8:51:26 AM8/11/14
to orient-...@googlegroups.com
If I try to connect to the DB thru studio from the browser


it shows this in the log:

 java.io.IOException: The process cannot access the file because another process has locked a portion of the file [ONetworkProtocolHttpDb]

Since I am already connected to the same database "test" from tomcat server. I think whoever I open first locks the DB so other app won't be able to access the DB. I need to access the DB from studio and code at the same time for many reasons. 
Please guide me to a best practice way to handle connections and DB locking for my case.

Thanks,
Kareem

Enrico Risa

unread,
Aug 11, 2014, 8:54:13 AM8/11/14
to orient-...@googlegroups.com
Hi Kareem

how do you open the database from tomcat server?

plocal or remote?




--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kareem Jabr

unread,
Aug 11, 2014, 6:41:37 PM8/11/14
to orient-...@googlegroups.com

Plocal
Factory = new OrientGraphFactory("plocal:d:/db/test");
Factory.getTx()

You received this message because you are subscribed to a topic in the Google Groups "OrientDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orient-database/ny6WHJZ7_Ok/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orient-databa...@googlegroups.com.

Enrico Risa

unread,
Aug 11, 2014, 7:17:12 PM8/11/14
to orient-...@googlegroups.com
Hi Kareem

you can use embedded server Take a look here.
Let's you connect in plocal but you can use tool like Studio and Console

Kareem Jabr

unread,
Aug 12, 2014, 5:34:16 AM8/12/14
to orient-...@googlegroups.com, enric...@gmail.com
Thanks Enrico, I really appreciate it. 
Can I then call


new OrientGraphFactory("plocal:d:/db/test");


after:
 server.activate();
I prefer doing this as below,
OServer server = OServerMain.create();
server.startup(new File("/usr/local/temp/db.config"));
server.activate();

The documentation is not really clear regarding the best practices on how to use it in a prodcution level.
1) What shall I keep in this file: db.config?
2) I have come across this: 
<listener protocol="http" port-range="2480-2490" ip-address="0.0.0.0">
  <commands>
    <command implementation="com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent" pattern="GET|www GET|studio/ GET| GET|*.htm GET|*.html GET|*.xml GET|*.jpeg GET|*.jpg GET|*.png GET|*.gif GET|*.js GET|*.css GET|*.swf GET|*.ico GET|*.txt GET|*.otf GET|*.pjs GET|*.svg">
      <parameters>
        <entry value="Cache-Control: no-cache, no-store, max-age=0, must-revalidate\r\nPragma: no-cache" name="http.cache:*.htm *.html"/>
        <entry value="Cache-Control: max-age=120" name="http.cache:default"/>
      </parameters>
    </command>
  </commands>
</listener> 
When is this needed?

Enrico Risa

unread,
Aug 12, 2014, 7:07:39 AM8/12/14
to orient-...@googlegroups.com
Hi Kareem 

you call this:


OServer server = OServerMain.create();
server.startup(new File("/usr/local/temp/db.config"));
server.activate();
At the startup of your application, then from your application code you can use

new OrientGraphFactory("plocal:d:/db/test");


For the db.config it is the configuration of the Server where you set the listening port binary http etc..

I use this configuration in a Play application.


Before starting the server i configured with java api the ORIENTDB_HOME

System.setProperty("ORIENTDB_HOME", "path");

I load a custom orientdb-config.xml
start the server

and then you can reproduce the folder structure of the Server with

path/ 
       databases/
       plugins/

in plugins i copied a dist of OrientDB Studio

and then i was able to run queries from studio opening my browser

Kareem Jabr

unread,
Aug 14, 2014, 10:35:50 AM8/14/14
to orient-...@googlegroups.com, enric...@gmail.com
Hi Enrico,

Thanks for your help after using the remote it is now working well without locking issues. I really appreciate it.
Reply all
Reply to author
Forward
0 new messages