Discussion:
[orientdb] In 3.0.0 unlike ODatabaseDocumentTx , OrientDB constructor throwing exception for in memory DB
arjun dhar
2018-05-14 05:23:11 UTC
Permalink
Hi,

*Summary*
Am on OrientDB 3.0.0 ; and am trying to avoid the use of Depreicated API
like: ODatabaseDocumentTx
However, when I replace it with
com.orientechnologies.orient.core.db.OrientDB ; for the same configs that
otherwise work fine it blows up.

Details below...

*Configuration*
```
odb.url=memory:neurosys_orientdb_odb
odb.username=admin
odb.password=admin
odb.maxPartitionSize=2
odb.maxPoolSize=10
```

*Spring Configs *using ODatabaseDocumentTx that work
```
<bean id="*dataSourceOdb*"
class="com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx"
init-method="create">
<constructor-arg value = "${odb.url}"/>
</bean>

<bean id="connectionPoolDataSourceOdb"
class="com.orientechnologies.orient.core.db.OPartitionedDatabasePool">
<constructor-arg value = "${odb.url}" index="0"/>
<constructor-arg value = "${odb.username}" index="1"/>
<constructor-arg value = "${odb.password}" index="2"/>
<constructor-arg value = "${odb.maxPartitionSize}" index="3"/>
<constructor-arg value = "${odb.maxPoolSize}" index="4"/>
</bean>
```

*Spring Configs *using com.orientechnologies.orient.core.db.OrientDB that
does *not *work
Simply replacing the `*dataSourceOdb*` bean.
```
<bean id="dataSourceOdbNew"
class="com.orientechnologies.orient.core.db.OrientDB">
<constructor-arg value = "${odb.url}"/>
<constructor-arg value = "${odb.username}" />
<constructor-arg value = "${odb.password}" />
<constructor-arg><null /></constructor-arg>
</bean>
```

*Exception thrown*
```
com.orientechnologies.orient.core.exception.ODatabaseException: Cannot open
database 'neurosys_orientdb_odb'
at
com.orientechnologies.orient.core.db.OrientDBEmbedded.open(OrientDBEmbedded.java:140)
at
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:908)
at
com.orientechnologies.orient.core.db.OPartitionedDatabasePool$DatabaseDocumentTxPooled.internalOpen(OPartitionedDatabasePool.java:441)
at
com.orientechnologies.orient.core.db.OPartitionedDatabasePool.openDatabase(OPartitionedDatabasePool.java:306)
at
com.orientechnologies.orient.core.db.OPartitionedDatabasePool.acquire(OPartitionedDatabasePool.java:261)
...
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: com.orientechnologies.orient.core.exception.OStorageException:
Cannot open the storage 'neurosys_orientdb_odb' because it does not exist
in path: D:\orientdb\./neurosys_orientdb_odb
at
com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:267)
at
com.orientechnologies.orient.core.db.OrientDBEmbedded.open(OrientDBEmbedded.java:131)
... 34 more

```

*Possible cause*
Looks like the path is getting messed up and assuming unix convention path
even for an in memory DB. Am on windows, but I dont see why that anyway
matters for an in-memory DB, plus it works with the deprecated one. *So I
assume this to be a bug, if not please let me know what Im missing.*

thanks,
Arjun
--
---
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-database+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Luigi Dell'Aquila
2018-05-14 07:16:35 UTC
Permalink
Hi Arjun,

Thank you very much for reporting, I'll check it asap.

Thanks

Luigi
Post by arjun dhar
Hi,
*Summary*
Am on OrientDB 3.0.0 ; and am trying to avoid the use of Depreicated API
like: ODatabaseDocumentTx
However, when I replace it with com.orientechnologies.
orient.core.db.OrientDB ; for the same configs that otherwise work fine
it blows up.
Details below...
*Configuration*
```
odb.url=memory:neurosys_orientdb_odb
odb.username=admin
odb.password=admin
odb.maxPartitionSize=2
odb.maxPoolSize=10
```
*Spring Configs *using ODatabaseDocumentTx that work
```
<bean id="*dataSourceOdb*" class="com.orientechnologies.
orient.core.db.document.ODatabaseDocumentTx" init-method="create">
<constructor-arg value = "${odb.url}"/>
</bean>
<bean id="connectionPoolDataSourceOdb" class="com.orientechnologies.
orient.core.db.OPartitionedDatabasePool">
<constructor-arg value = "${odb.url}" index="0"/>
<constructor-arg value = "${odb.username}" index="1"/>
<constructor-arg value = "${odb.password}" index="2"/>
<constructor-arg value = "${odb.maxPartitionSize}" index="3"/>
<constructor-arg value = "${odb.maxPoolSize}" index="4"/>
</bean>
```
*Spring Configs *using com.orientechnologies.orient.core.db.OrientDB that
does *not *work
Simply replacing the `*dataSourceOdb*` bean.
```
<bean id="dataSourceOdbNew" class="com.orientechnologies.
orient.core.db.OrientDB">
<constructor-arg value = "${odb.url}"/>
<constructor-arg value = "${odb.username}" />
<constructor-arg value = "${odb.password}" />
<constructor-arg><null /></constructor-arg>
</bean>
```
*Exception thrown*
```
com.orientechnologies.orient.core.exception.ODatabaseException: Cannot
open database 'neurosys_orientdb_odb'
at com.orientechnologies.orient.core.db.OrientDBEmbedded.open(
OrientDBEmbedded.java:140)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(
ODatabaseDocumentTx.java:908)
at com.orientechnologies.orient.core.db.OPartitionedDatabasePool$
DatabaseDocumentTxPooled.internalOpen(OPartitionedDatabasePool.java:441)
at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.
openDatabase(OPartitionedDatabasePool.java:306)
at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.acquire(
OPartitionedDatabasePool.java:261)
...
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.
main(RemoteTestRunner.java:192)
Cannot open the storage 'neurosys_orientdb_odb' because it does not exist
in path: D:\orientdb\./neurosys_orientdb_odb
at com.orientechnologies.orient.core.storage.impl.local.
OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:267)
at com.orientechnologies.orient.core.db.OrientDBEmbedded.open(
OrientDBEmbedded.java:131)
... 34 more
```
*Possible cause*
Looks like the path is getting messed up and assuming unix convention path
even for an in memory DB. Am on windows, but I dont see why that anyway
matters for an in-memory DB, plus it works with the deprecated one. *So I
assume this to be a bug, if not please let me know what Im missing.*
thanks,
Arjun
--
---
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
For more options, visit https://groups.google.com/d/optout.
--
---
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-database+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Luigi Dell'Aquila
2018-05-14 12:07:21 UTC
Permalink
Hi Arjun,

With the new API the db creation is a bit different, programmatically it
would be something as follows:

OrientDB orient = new OrientDB("embedded:./",config);
orient.create("neurosys_orientdb_odb",ODatabaseType.MEMORY);

// and create a pool
ODatabasePool pool = new ODatabasePool(orient,"neurosys_orientdb_odb
","admin","admin",config);

// or open a connection directly
orient.open("neurosys_orientdb_odb","admin","admin",config);


So you need four parameters:
- the db path ("embedded:./" in this case, but if you only have in-memory
databases you can hard-wire it, as it will never be used)
- the actual db name (neurosys_orientdb_odb)
- the username
- the password

Probably you will have to do little changes to your application
accordingly, but it should not be too complex

I hope it helps

Thanks

Luigi
Post by Luigi Dell'Aquila
Hi Arjun,
Thank you very much for reporting, I'll check it asap.
Thanks
Luigi
Post by arjun dhar
Hi,
*Summary*
Am on OrientDB 3.0.0 ; and am trying to avoid the use of Depreicated API
like: ODatabaseDocumentTx
However, when I replace it with com.orientechnologies.ori
ent.core.db.OrientDB ; for the same configs that otherwise work fine it
blows up.
Details below...
*Configuration*
```
odb.url=memory:neurosys_orientdb_odb
odb.username=admin
odb.password=admin
odb.maxPartitionSize=2
odb.maxPoolSize=10
```
*Spring Configs *using ODatabaseDocumentTx that work
```
<bean id="*dataSourceOdb*" class="com.orientechnologies.o
rient.core.db.document.ODatabaseDocumentTx" init-method="create">
<constructor-arg value = "${odb.url}"/>
</bean>
<bean id="connectionPoolDataSourceOdb" class="com.orientechnologies.o
rient.core.db.OPartitionedDatabasePool">
<constructor-arg value = "${odb.url}" index="0"/>
<constructor-arg value = "${odb.username}" index="1"/>
<constructor-arg value = "${odb.password}" index="2"/>
<constructor-arg value = "${odb.maxPartitionSize}" index="3"/>
<constructor-arg value = "${odb.maxPoolSize}" index="4"/>
</bean>
```
*Spring Configs *using com.orientechnologies.orient.core.db.OrientDB
that does *not *work
Simply replacing the `*dataSourceOdb*` bean.
```
<bean id="dataSourceOdbNew" class="com.orientechnologies.o
rient.core.db.OrientDB">
<constructor-arg value = "${odb.url}"/>
<constructor-arg value = "${odb.username}" />
<constructor-arg value = "${odb.password}" />
<constructor-arg><null /></constructor-arg>
</bean>
```
*Exception thrown*
```
com.orientechnologies.orient.core.exception.ODatabaseException: Cannot
open database 'neurosys_orientdb_odb'
at com.orientechnologies.orient.core.db.OrientDBEmbedded.open(O
rientDBEmbedded.java:140)
at com.orientechnologies.orient.core.db.document.ODatabaseDocum
entTx.open(ODatabaseDocumentTx.java:908)
at com.orientechnologies.orient.core.db.OPartitionedDatabasePoo
l$DatabaseDocumentTxPooled.internalOpen(OPartitionedDatabase
Pool.java:441)
at com.orientechnologies.orient.core.db.OPartitionedDatabasePoo
l.openDatabase(OPartitionedDatabasePool.java:306)
at com.orientechnologies.orient.core.db.OPartitionedDatabasePoo
l.acquire(OPartitionedDatabasePool.java:261)
...
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
RemoteTestRunner.java:192)
Cannot open the storage 'neurosys_orientdb_odb' because it does not exist
in path: D:\orientdb\./neurosys_orientdb_odb
at com.orientechnologies.orient.core.storage.impl.local.OAbstra
ctPaginatedStorage.open(OAbstractPaginatedStorage.java:267)
at com.orientechnologies.orient.core.db.OrientDBEmbedded.open(O
rientDBEmbedded.java:131)
... 34 more
```
*Possible cause*
Looks like the path is getting messed up and assuming unix convention
path even for an in memory DB. Am on windows, but I dont see why that
anyway matters for an in-memory DB, plus it works with the deprecated one. *So
I assume this to be a bug, if not please let me know what Im missing.*
thanks,
Arjun
--
---
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
For more options, visit https://groups.google.com/d/optout.
--
---
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-database+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...