Connecting to a remote objectdb server

#1

I am trying to configure my application in a client-server objectdb setup via tcp/ip. So I first made sure that the remote objectdb server is running using telnet from my local. 

$ telnet db.mydomain.com 6136 (worked fine, is able to connect...)

My db was configured below:

<server>
  <connection port="6136" max="100" />
  <data path="objectdb://db.mydomain.com/db" />
</server>

On my application, I had configured my persistence unit like below.

    <persistence-unit name="defaultObjectDBPersistenceUnit" transaction-type="RESOURCE_LOCAL">
        <provider>com.objectdb.jpa.Provider</provider>
        <properties>
            <property name="javax.persistence.jdbc.url" value="objectdb://db.mydomain:6136/db/myapp.odb"/>
            <property name="javax.persistence.jdbc.user" value="admin"/>
            <property name="javax.persistence.jdbc.password" value="admin"/>
        </properties>
    </persistence-unit>

With all these configuration, I am still not able to connect on remote server. I am pretty sure that defaultObjectDBPersistenceUnit was used on my app. Also, if my app was able to connect to the remote db, it should have create the db files on db server. 

So what am I missing here?

#2

The setting of the server data element is invalid:

    <data path="objectdb://db.mydomain.com/db" />

The objectdb: prefix is used on the client to connect to the database. On the server you just specify an absolute path (or relative, starting with $objectdb) for the database root directory.

See this manual page.

 

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

I've tried your suggestion already. Isn't that objectdb should create the db files on the root folder of server? I do not see any files in the db folder or directory.

That means our app is not connected to db server even if I had configured our client app like below... 

  • <property name="javax.persistence.jdbc.url" value="objectdb://db.mydomain.com/db/myapp.odb"/> - when objectdb on remote server
  • <property name="javax.persistence.jdbc.url" value="objectdb://db.mydomain.com:6136/db/myapp.odb"/> - when objectdb on remote server
  • <property name="javax.persistence.jdbc.url" value="objectdb://localhost/db/myapp.odb"/> - when objectdb on localhost
  • <property name="javax.persistence.jdbc.url" value="objectdb://localhost:6136/db/myapp.odb"/> - when objectdb on localhost

The objectdb.conf server data url configured like:

<data path="$objectdb/db" />

Thoughts?

 

#4

The database file should be created, unless the ObjectDB Server process has no permission to create files at that path. Please check also the ObjectDB log file on the server side for errors.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#5

I had made sure that objectdb has rights to create files. So I think there is no issue on that. 

Still, no db files were created. Tried this url too, "objectdb://localhost:6136/db/myapp.odb;user=admin;password=admin" to connect to my localhost server running on port 6236.

So I am wondering, maybe you could show me the minimum configuration for client persistence unit and server objectdb.conf so I can compare mine. 

Also, from I had notice that everytime I run my app, it created db folder on application root folder and create *.tmp files. Which I believe are temporary db files.

 

#6

Please try the following:

  1. Download the last version of ObjectDB and extract the zip file.
  2. Make sure that everyone has read/write/execute permissions in the extracted directory (including subdirectories).
  3. Run the server at that location (e.g. double click objectdb.jar).
  4. Run the following client Java console program:
public final class T1553
{
    public static void main(String[] args) throws Exception {
   
        EntityManagerFactory emf =
            Persistence.createEntityManagerFactory(
                "objectdb://localhost:6136/myapp.odb;admin");
        emf.createEntityManager().close();
        emf.close();
    }
}

No need to change the default configuration, in which $objectdb/db is already the root db directory.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login