• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

RDBMS in J2EE

 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.
Is not too clear for me how the RDBMS should be used while building an application using J2EE?
Which would be the recommended approach ? for ... let's say a
a forum like this ( The Big Moose saloon )
would JSP/servlet using classes with JDBC would be enough
What if the project grows ?
Does EJB use RDBMS for persistence ?
Some ligth on this ?
Thanks
 
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm not sure to fully understand your question.
Using J2EE is not a solution to replace RDBMS.
J2EE is just a normed platform you can use to build you N-tier application.
The first Tier is the client (browser, wap, java)
The second tier is the middleware (WebServer, application server)
The third tiers is the Enterprise Information System. It is your RDBMS if you use one.
EJB spec just specifis how you will "design" your access to the RDBMS, using entityBeans and persistence mechanism for example.
But the data are still saved in a database.
Just let me know if I missed something.
 
Zkr Ryz
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bill Bailey:
Hi,
I'm not sure to fully understand your question.
Using J2EE is not a solution to replace RDBMS.
J2EE is just a normed platform you can use to build you N-tier application.
The first Tier is the client (browser, wap, java)
The second tier is the middleware (WebServer, application server)
The third tiers is the Enterprise Information System. It is your RDBMS if you use one.
EJB spec just specifis how you will "design" your access to the RDBMS, using entityBeans and persistence mechanism for example.
But the data are still saved in a database.
Just let me know if I missed something.


Thanks Bill, I've been working with JSP/servlets for a while, bye now I only use auxiliary classes to make the connections with db, I have something like this in my servlet..
Message ma [] = Message.getAllMessages();
for( int i = 0 ; i < ma.length ; i++ ){
// process ma[i];
}
and Message is a class that use JDBC,
something tells me that this approach is not quite wrong but I feel things could be done different.
My questions is :
Which is the recommended approach for use RDBMS in J2EE . . .
 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Design of database and EJB should better be considered at the sametime or ore before another ? Or I believe it is an iterate process ?

Thanks
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Zkr Ryz
I can't answer you question here, because it depends on the application you are working on.
Nevertheless, there is some questions you can ask yourself to decide whether or not you need EJBs.
When you access the Database :
1) Do you need a transaction and do you want to code the transaction management ?
2) Do you need a pool of connections and do you want to code the pool yourself ?
3) Do you want to set an isolation level and do you want to manage it in your code ?
4) Do you want to have programmatic security rules or declarative security rules ?
etc... etc...

I mean, EJBs just provide you some easy, secured and normalized way to access a RDBMS.
The EJB container performs some job for you.
But you can keep coding it using JDBC from servlet. It's up to you.
Just one more point.
Ejbs do use RDBMS for persistence (CMP or O/R mapping)
Does that help a bit more ?

Originally posted by Zkr Ryz:
Which is the recommended approach for use RDBMS in J2EE . . .


 
Zkr Ryz
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It does Bill thanks.
So, using JDBC or EJB to store data depends more on the complexity of the webapp... for a small three pages site
using JDBC with axxess ( ) would be enough
but if the webapp is know to grow in the future using EJB should be considered.
Thanks Bill.
 
ruilin yang
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does CMP of EJB 2.0 support table relationship? I know CMP of EJB 1.1 does not.
If the relationship is supported how is it mapped, automatically, or a lots manual work ?
Thanks
Ruilin
 
Zkr Ryz
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by ruilin yang:
Does CMP of EJB 2.0 support table relationship? I know CMP of EJB 1.1 does not.
If the relationship is supported how is it mapped, automatically, or a lots manual work ?
Thanks
Ruilin


Whats CMP Rulin ?
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think Ruilin meant CMP2.0.
CMP2.0 uses Abstract Persistence Schema to model the relationship between tables with EJBs.
You can learn CMP2.0 in J2EE 1.3 tutorial CMP example Roster Application.
Relationships are defined in Deployment Descriptors.
 
ruilin yang
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks to your guys.
For CMP od EJB 2.0 I meant Container managed persistent of EJB 2.0 version.
Vector, Would you give me the URL for
"learn CMP2.0 in J2EE 1.3 tutorial CMP example Roster Application".
Thanks
Ruilin
 
Ranch Hand
Posts: 1874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will try to attempt at this one.
Zkr , You are not going to replace database with j2ee. it depends whether you are going for client - server architecture or n - tier. If you are just require small information which doesn't require business logic , then web application client can directly talk to database.
If you are calling throgh applet , you may have to go to web container which in turn calls database.
If your application is large scale , having business logic then you would like to give that bull work to middle tier , where j2ee comes into picture. There , you will have web container , Ejb Container. this comes with goodies like security checks , resource pooling , state management & declarative transaction management. Plus , the container writer has to see these features in his app. server. Developer is reduced of burden of thinking about all these things. The framework is built.
But , this doesn't replace your database. it is going to be there.
I hope I am understanding your question correctly.
Shailesh.
 
ruilin yang
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I thought that for designing an application, to design a solid datamodel always first, then design the application logic. With EJB (Entity beans) is it still true or the database structure is dicteted by the EJB architecture ?
I confused
Thanks
Ruilin
 
Zkr Ryz
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks shailesh sonavadekar
Yes I undestand that J2EE won't substitute my db the question was more focussed on the way to access data stored, either bye using JDBC or EJB, now I understand that the complexity of the app determines that.
For a small, centralized application JDBC is enough but for a large project that use differents "front ends" ( HTML, XML, WAP, client side ) or whose complexity is high EJB should be considered..

am I right ?
[This message has been edited by Zkr Ryz (edited December 06, 2001).]
 
shailesh sonavadekar
Ranch Hand
Posts: 1874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ZKR , Sun's specification defines following containers : -
On Web client side : - ( You can say Client Tier )

Applet Container ( it can act as powerful user interface for j2ee apps.)
Application Client container

j2ee container : - ( Middle Tier )
EJB Container ( EJB )
Web Container ( JSP / Servlets )
Database Tier : -

Various databases like oracle , db2 , etc.
Specifications require that all the container must provide a Java Compatible runtime environment. So , J2SE comes. So , come JDBC support.
Web client can access directly dabase by using jdbc or through EJB as sevice provider interface to attach jdbc driver to j2ee platform.
So , It all depends upon what your application is all about.
Shailesh.
 
reply
    Bookmark Topic Watch Topic
  • New Topic