You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Mohanbabu Narayanasamy <mx...@bjc.org> on 2006/07/13 20:30:45 UTC

Persistence with MINA?

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
 
 
 
 
 

Re: Persistence with MINA?

Posted by Trustin Lee <tr...@gmail.com>.
Hi Mohanbabu,

On 7/14/06, Mohanbabu Narayanasamy <mx...@bjc.org> wrote:
>
> that'll be great. I'm at an early stage of this integration. I'll submit
> a sample code in next 2/3 weeks.


Any good news? :)

Regards,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

Re: Persistence with MINA?

Posted by Mohanbabu Narayanasamy <mx...@bjc.org>.
that'll be great. I'm at an early stage of this integration. I'll submit
a sample code in next 2/3 weeks.
 
thanks
Babu
 
 

>>> "peter royal" <pr...@apache.org> Thursday, July 13, 2006 7:36:14
PM >>>

On Jul 13, 2006, at 4:57 PM, Mohanbabu Narayanasamy wrote:
> voila!! I have figured it out.

excellent!

> Thanks everyone for your input. I'll create a simple application as
an
> example. If anyone is interested, please let me know.

That would be an excellent contribution. We can add it to the samples 

for others to see in the future.

-pete


-- 
proyal@apache.org - http://fotap.org/~osi





Re: Persistence with MINA?

Posted by peter royal <pr...@apache.org>.
On Jul 13, 2006, at 4:57 PM, Mohanbabu Narayanasamy wrote:
> voila!! I have figured it out.

excellent!

> Thanks everyone for your input. I'll create a simple application as an
> example. If anyone is interested, please let me know.

That would be an excellent contribution. We can add it to the samples  
for others to see in the future.

-pete


-- 
proyal@apache.org - http://fotap.org/~osi




Re: Persistence with MINA?

Posted by Michael Bauroth <Mi...@falcom.de>.
Hi Mohanbabu,

I would be interested in your example :)

Regards
Michael


Mohanbabu Narayanasamy wrote:
> 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" <el...@gmail.com> 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 <mx...@bjc.org> 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" <mi...@onlinehome.de> 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
>>
>>
>>
>>
>>
> 
> 
> 

-- 

_____ FALCOM GmbH ______________________________________________________

Dipl.-Ing. Michael Bauroth
Manager Software Department

Phone:   +49 3677 8042 332
Fax:     +49 3677 8042 215
E-mail:  michael.bauroth@falcom.de

Address: Gewerbering 6, 98704 Langewiesen, Germany

______________________________ www.falcom.de ___________________________

This e-mail and any files transmitted are the property of FALCOM and/or
its affiliates, are confidential, and are intended solely for the use of
the individual or entity to whom this e-mail is addressed. If you are
not one of the named recipients or otherwise have reason to believe that
you have received this e-mail in error, please notify the sender and
delete this message immediately from your computer. Any other use,
retention, dissemination, forwarding, printing or copying of this e-mail
is strictly prohibited.

Re: Persistence with MINA?

Posted by Mohanbabu Narayanasamy <mx...@bjc.org>.
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" <el...@gmail.com> 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 <mx...@bjc.org> 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" <mi...@onlinehome.de> 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
> >
>
>
>
>
>



Re: Persistence with MINA?

Posted by Mark <el...@gmail.com>.
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 <mx...@bjc.org> 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" <mi...@onlinehome.de> 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
> >
>
>
>
>
>

Re: Persistence with MINA?

Posted by Mohanbabu Narayanasamy <mx...@bjc.org>.
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" <mi...@onlinehome.de> 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
>   




Re: Persistence with MINA?

Posted by Michael Link <mi...@onlinehome.de>.
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
>