On Saturday, December 26, 2015 at 11:25:10 PM UTC+1, Erik Pragt wrote: > > Hi /m, > > Yes, I think that would work, thanks! And when I'm done with the > connection, can I just close it (or use an ARM block) ? >
yes, I tend to use finally block to close it (dunno if it implements closeable interface stuff for auto resources...probably it does) cheers /m > > 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.
