views:

56

answers:

3

Dear All,

I just start reading Sun's JDBC tutorial. I installed MySQL Connector/J and was just skimming through its menu, then came across this statement:

"Although JDBC is useful by itself, we would hope that if you are not familiar with JDBC that after reading the first few sections of this manual, that you would avoid using naked JDBC for all but the most trivial problems and consider using one of the popular persistence frameworks such as Hibernate, Spring's JDBC templates or Ibatis SQL Maps to do the majority of repetitive work and heavier lifting that is sometimes required with JDBC"

So what are the relationships between Spring, Hibernate, JDBC? What does the statement mean by saying "avoid using naked JDBC"?

Thanks,

Sarah

+1  A: 

"avoid using naked JDBC" - Don't use the JDBC API directly.

Hibernate - A database persistence framework. It lets you store Java objects in databases. Pretty nifty.

Spring - It's actually a web development framework. The JDBC templates are an abstraction to JDBC, I think.

alpha123
+6  A: 

If you use Hibernate, Spring's JDBC templates or Ibatis SQL Maps, you're still using JDBC, but you don't have to deal with it directly. They're doing it for you, and to a degree, insulate you from some difficulties in the use of JDBC.

Hibernate is an object-relational-mapping framework.

MyBatis, formerly known as iBatis, is a data mapping framework.

Spring is a wide-ranging set of web framework components, and includes templating subsystems that allow integration with JDBC, Hibernate, or iBatis and abstract away some of the details of dealing with any of them.

You should indeed learn JDBC, but also (eventually) learn some of these others and try to avoid using JDBC directly for anything very complex.

These ideas are also (especially Hibernate) closely related to the Java Persistence API (JPA), which is also certainly worth learning.

You might also want to look at Java Data Objects (JDO).

Don't try to learn it all at once, though.

Starting with JDBC is a good idea. Staying with it is not.

Don Roby
*"Starting with JDBC is a good idea. Staying with it is not."* +1 for that (and the rest also)
Pascal Thivent
Thanks. Love your answer because you also pointed out the learning direction apart from information.
sarahTheButterFly
A: 

Alphabets > Words > Sentences.

That is how we learn (natural) language.

Similarly, I see:

JDBC API > JDBC API with Connection Pooling > Spring JDBC Template > ORM/JPA/JDO

HanuAthena