Hi /m,

I tested this, and it doesn't work :-(

I was using this: 
OObjectDatabaseTx acquire = OObjectDatabasePool.global().acquire();, 

but it's deprected. Now I have to use this:

OPartitionedDatabasePool oPartitionedDatabasePool = new 
OPartitionedDatabasePool("x", "x", "y");
ODatabaseDocumentTx acquire1 = oPartitionedDatabasePool.acquire();


But that's returning a ODatabaseDocumentTx, while I need an OObjectDatabaseTx.


The only workaround I've found so far, is to use this:


OPartitionedDatabasePool oPartitionedDatabasePool = new 
OPartitionedDatabasePool("x", "x", "y");
OObjectDatabaseTx acquire1 = new 
OObjectDatabaseTx(oPartitionedDatabasePool.acquire());


But it looks like a pretty expensive operation, if I look at the sourcecode. Is 
this the way to go?


Thanks,

Erik





On Saturday, December 26, 2015 at 10:22:05 PM UTC+1, machak wrote:
>
> Hi Eric,
>
>
> On Saturday, December 26, 2015 at 7:58:38 PM UTC+1, Erik Pragt wrote:
>>
>> Btw, even the documentation, as listed here: 
>> http://orientdb.com/docs/2.0/orientdb.wiki/Document-Database.html, still 
>> recommends using the deprecated  ODatabaseDocumentPool.global() code. Is 
>> this correct?
>>
>> you could use:
>
> pool = new OPartitionedDatabasePool(getUrl(), getUsername(), getPassword(), 
> getMaxPoolSize());
>
>
> public ODatabaseDocumentTx openDatabase() {
>     return pool.acquire();
> }
>
>
>  
> cheers
> /m
>
> On Saturday, December 26, 2015 at 7:34:28 PM UTC+1, Erik Pragt wrote:
>>>
>>> Hi all,
>>>
>>> I was wondering, what's the correct way of using connections to an 
>>> OrientDB from my Java webapp? According to the OrientDB book, it's to use 
>>> ODatabaseDocumentPool.global(), which is deprectated. Currently, I just 
>>> create a new connection every time, something like this:
>>>
>>>
>>> public void setUserName(String name) {
>>>
>>>   ODatabaseDocumentTx db = new 
>>> ODatabaseDocumentTx("remote:localhost/demo").open("demo", "demo")
>>>   db.command(new OCommandSQL("update User set name=?")).execute(name);
>>>   db.close();
>>>
>>> }
>>>
>>>
>>> But this seems hardly the best way. What's the idiomatic way of handling 
>>> connections in OrientDB?
>>>
>>>
>>> Thanks,
>>>
>>>
>>> Erik
>>>
>>>
>>>
>>>
>>>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to