Interfacing with Database on Server
vimana
jsaund2000 at rogers.com
Thu Oct 22 16:42:43 EDT 2009
Hi,
I'm having difficulty understanding how to interface with a DB (MySQL) on
the Server.
>From what I've gathered, I'll need to create a connection pool (which I've
done using Apache DBCP), add an execution handler to my pipeline (I used the
OrderedMemoryAwareThreadPoolExecutor) and my business logic handler checks
if the request from the client is to save something to the db or retrieve
something from the db. I then would want the business logic handler to pass
this request to the execution handler which will grab a connection from the
connection pool and run the query. If the query was to return a result to
the client then the execution handler would write the result back to the
client. I'm not sure if this is the correct way to go about it and if it is
how do I pass the request from the logic handler to execution handler
(sendupstream?). And How does the execution handler receive the message ? Do
i attach a runnable object to the context object associated with the channel
in the business logic handler, sendupstream and then in the handleupstream
in Executionhandler get the attachment and do a
.execute((Runnble)ctx.getAttachment())?
It would help a lot if I can get a high level overview of the correct way to
interact with the database.
Thanks!
--
View this message in context: http://n2.nabble.com/Interfacing-with-Database-on-Server-tp3874876p3874876.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list