File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes SQLJ vs JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "SQLJ vs JDBC" Watch "SQLJ vs JDBC" New topic


robyne vaughn
Ranch Hand

Joined: Jun 04, 2003
Posts: 39
I'm new to Java and want to do some database manipulation. What are the advantages of using either SQLJ or JDBC? I've been working with JDBC a little and wonder if there is some kind of buffer limit on bytes returned from the database using a prepared statement. I wonder if I should change my focus and consider SQLJ.
I'm trying to develop a web application. j2ee.
What do I consider when trying to make a choice?
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
moving to the JDBC forum

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Sujatha Ranganathan

Joined: May 29, 2003
Posts: 12
You may want to have a look at the JDBC & SQLJ documentation on OTN
JDBC & SQLJ Sample code available at
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1141

Hi Robyne,
As far as I know, SQLJ is just one more level of abstraction. You write "embedded" SQL in your java code, which then gets translated into JDBC code. So the only difference (as far as I can tell) is ease of coding. I imagine some people would prefer to write embedded SQL rather than JDBC code directly.
Hope this has helped you.
Good Luck,
Nitin Parashar
Ranch Hand

Joined: Jun 06, 2003
Posts: 52
The main difference between JDBC and SQLJ is that while JDBC provides access through dynamic SQL, SQLJ provides access through embedded static, SQL. Thus the traditional benefits of static SQL for Java language programs are all provided by SQLJ.

SCJP 1.4, SCWCD 1.4, SCBCD 1.3
robyne vaughn
Ranch Hand

Joined: Jun 04, 2003
Posts: 39
Thanks so much. You all offered good suggestions and information.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

I will chime in here in recommend using Hibernate.
This allows you to get away from SQL totally if you want to and concentrate on your application rather than debugging SQL statements. I have just started using it over the past few days and I am pretty impressed. Plus, they just released their Version 2. So it's hot off the press. Another bonus: Open Source and FREE.

GenRocket - Experts at Building Test Data
I agree. Here's the link:
subject: SQLJ vs JDBC
It's not a secret anymore!