wood burning stoves 2.0*
The moose likes Java in General and the fly likes Java and PL/SQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Java and PL/SQL" Watch "Java and PL/SQL" New topic
Author

Java and PL/SQL

Harsha Smith
Ranch Hand

Joined: Jul 18, 2011
Posts: 287
Why is it important for a java programmer to learn and master PL/SQL?
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
I don't think so
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10426
    
    8

I wouldn't say its true for all programmers to master PL/SQL. If you are working on DBs, then it would be very important. For other programmers, a moderate knowledge (as compared to mastery) would be sufficient. Of course knowledge is never wasted, so investing some free time in upgrading PL/SQL skills would be definitely recommended.
On a side note, is anything ever mastered? It's been my experience that there is always something new to learn.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Harsha Smith
Ranch Hand

Joined: Jul 18, 2011
Posts: 287
And expert SQL knowledge? isn't it a must have skill?
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Harsha,

In my current project we have an RDF engine as our database. Our data are stored in the format of triples. We use SPARQL and Prolog languages to query and save data in database.

But in my opinion a sound knowledge of SQL is important - it gives you a base to understand other query languages...and even Hibernate better...
Harsha Smith
Ranch Hand

Joined: Jul 18, 2011
Posts: 287
Alright. I am ready to invest 3 months of time? What do you advice me to do? Learn Oracle SQL and PL/SQL thoroughly or hibernate??? I am a java programmer.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39084
    
  23
Do you think you can become expert at anything in 3 months?
Harsha Smith
Ranch Hand

Joined: Jul 18, 2011
Posts: 287
atleast very good if not expert.......My question hasn't been answered yet?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14194
    
  20

It is hard to answer this question in a general way. As a Java programmer, sooner or later you're going to have to work with relational databases, because the whole world stores their data in relational databases. So it is essential to understand at least the basics of relational databases and some SQL.

Object-relational mapping (ORM) frameworks such as Hibernate are widely used by Java developers. In most serious projects people don't write only low-level JDBC code to access the database.

It's certainly valuable to learn Hibernate, and you'll need to understand the concepts of relational databases and SQL to understand how Hibernate works.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Harsha Smith
Ranch Hand

Joined: Jul 18, 2011
Posts: 287
so learning essential SQL and PL/SQL skills is mandatory for any java programmer...right? and going beyond the basics won't hurt ... am I correct? Thank you so much for the replies
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1726
    
  14

Just to expand on Jesper's good advice:

Commercial applications almost always end up using a relational database somewhere to store data, and it is often the data that is the most valuable asset in the system. Application code changes all the time, technologies change every few years, but the data will often still be valuable years from now as people find new ways to use it. So it is worth understanding how databases work, and that goes beyond just learning SQL and doing an introductory SQL certificate of some kind. SQL is an excellent tool for accessing data in a relational database, but it is just as easy to write bad SQL as it is to write bad Java, and when you are working with large volumes of data your SQL mistakes can have a truly catastrophic impact on how the system performs. In my experience, Java developers are especially prone to this problem, because often they have the misguided idea that as Java EE development is complex (oh boy, is it complex...!), it is the only important aspect of a system they need to worry about, so they fail to recognise the need to use the right tool for the job when it comes to database applications. That tool might be Hibernate rather than pure SQL, but it still helps to understand what Hibernate is doing underneath.

So you need to understand something about relational databases and relational data modelling in order to use SQL properly, just as you need to understand object oriented programming in order to use Java properly. And you may also need to understand a bit about how your particular relational database works, because different RDBMS vendors may implement particular features (indexing, partitioning, query optimisation etc) in different ways, and even if somebody is responsible for managing these things, you may well need to know how to make good use of them with your SQL. It's just like the JEE platform: you can pretend it's all vanilla and you don't need to know how it works underneath, but you will usually find you produce better code if you understand what your platform (JEE or RDBMS) is really doing.

Finally, as you know, PL/SQL is Oracle's proprietary extension to SQL which is used almost everywhere in the Oracle world (PL/SQL has also been ported to PostgreSQL, although there may be some inconsistencies in the implementation and of course you will not have access to the Oracle-specific libraries etc). It's been around for about 20 years and these days is a very powerful tool for implementing complex logic simply, robustly and efficiently on the Oracle RDBMS server. As with any other language, it is worth understanding how it works so you can write good idiomatic PL/SQL code, rather than simply pretending it's Java without the brackets.

So if you're working on an Oracle-based application, learning PL/SQL would be very useful, but if you're not on Oracle, or if you are not permitted to use vendor-specific DB tools, then it will be less helpful to you.

My advice FWIW: Learn SQL and how to use it properly, then learn PL/SQL if you're on Oracle.


No more Blub for me, thank you, Vicar.
Harsha Smith
Ranch Hand

Joined: Jul 18, 2011
Posts: 287
Thank You Chris! I'll follow your advice
 
GeeCON Prague 2014
 
subject: Java and PL/SQL