voila!! I have figured it out. I was trying on the same lines as Mark explained. Then I added database connection settings (driver class,DB URL, username,password,schema,etc) in hibernate.cfg.xml and added the hibernate jars. Then , create a connection factory and used a simple DAO code, to read and write to DB2. I'm getting started on writing the "real" implementation of IoHandlerAdapter. Let's see where it takes me. Thanks everyone for your input. I'll create a simple application as an example. If anyone is interested, please let me know.
Babu >>> "Mark" <[EMAIL PROTECTED]> Thursday, July 13, 2006 2:02:17 PM >>> Being a MINA newbie, I may be off here. If you look at the EchoServer example code : http://svn.apache.org/viewvc/directory/trunks/mina/examples/src/main/java/org/apache/mina/examples/echoserver/Main.java?revision=400068&view=markup You see the line : acceptor.bind( new InetSocketAddress( PORT ), new EchoProtocolHandler(), config ); This function takes in an instance of EchoProtocolHandler. This class is what actually performs the processing of the data. In your application, you would write a class that extends IoHandlerAdapter, and in your messageReceived method, you would perform the database insert. Again, I am new to MINA, but I have not seen anything that leads me to believe that there is special database backend support for the server side. This is up to the end developer to create the customized class to perform the database updates. On 7/13/06, Mohanbabu Narayanasamy <[EMAIL PROTECTED]> wrote: > yes, I agree. > > I guess my question is this: After I do the client-server thingy with > MINA, how do I store it in DB? > > Atleast, MINA needs some interface to database, right? May be , my > problem has nothing to do with core-MINA code but a new interface or > layer ? > > please let me know If I'm incorrect and what do you think. > > thaks for your reply, > Babu > > >>> "Michael Link" <[EMAIL PROTECTED]> Thursday, July 13, 2006 > 1:40:31 PM >>> > > My view of MINA is that it has nothing to do with persistence at all. > Just receive the messages and process them with any Java-API you want. > MINA > is only the client-server part and shouldn't be mixed up with > persistence (like QuickServer does it for example). > > Mike > > Mohanbabu Narayanasamy wrote: > > Hi developers! > > > > We are writing a simple MINA implementation to receive XML messages > > from devices and store in it a DB2 / MySQL database (thousands of > > devices sending XML in few seconds - still in design). I'm very new > to > > MINA and would like to know how to interface with databases. > > > > 1. Is there any XML parser - tried and tested - which may be inbuilt > > > or coupled with MINA? (I read some XML codec is under development) > > 2. How to do database stuff? Is there anyone who has tried > integrating > > MINA with DB? (using JDBC/ Hibernate) > > 3. How about connection pooling,exception handling, etc ? > > 4. Do I have to write an all-new MINA-database persistence layer? or > > All my questions > > > > If some design just flashes in your mind, please let me know. A > > step-by-step guide would be great. Any advice / help is greatly > > appreciated. > > > > You guys are doing a great job and I'm more than happy to contribute > > anything I can. > > > > thanks > > Babu > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > No virus found in this incoming message. > > Checked by AVG Free Edition. > > Version: 7.1.394 / Virus Database: 268.9.10/386 - Release Date: > 12.07.2006 > > > > > > >
