This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Need help learning about databases Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Need help learning about databases" Watch "Need help learning about databases" New topic
Author

Need help learning about databases

Joe Daly
Ranch Hand

Joined: Dec 18, 2012
Posts: 45
Hi, i have done lot's of research about this but i can't seem to find what im looking for, i am curious about learning MySQL with JDBC but i cant seem to find a book for beginners that teaches MySQL or JDBC so if someone please recommend some books for either MySQL or JDBC it would be much appreciated, i don't learn well from reading stuff online about MySQL so could you please not just leave a link to a SQL or jdbc tutorial,
Thanks.
Akshay Madhuranath
Greenhorn

Joined: Nov 29, 2009
Posts: 20
Hey Joe,

Check this out. Head First SQL from O' Reilly publications. It gives you what you want.

Thanks,
Akshay
Joe Daly
Ranch Hand

Joined: Dec 18, 2012
Posts: 45
does it tech about JDBC ??
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1624
    
  13

Joe Daly wrote:does it tech about JDBC ??

JDBC is really a separate topic from MySQL, so learn about your database - SQL, data modelling etc - from a book if that's easier for you, then use online JDBC tutorials and the appropriate API documents to learn about the JDBC drivers for MySQL.


No more Blub for me, thank you, Vicar.
Joe Daly
Ranch Hand

Joined: Dec 18, 2012
Posts: 45
OK but after i read the head first SQL book how will i learn MySQL and also will the online JDBC/MySQL documentation tell me how to set up a IDE for using JDBC?
whats the difference between SQL and MySQL, and is online the only way to learn about them ?
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

There is an excellent JDBC tutorial online: oracle jdbc tutorial. If you already know something about databases and SQL, the JDBC tutorial is your next stop. I presume there could be an introductory book into JDBC as well, but I learned online, so I don't know.

Edit: the tutorial does mention setting up the development environment.

Joe Daly wrote:whats the difference between SQL and MySQL, and is online the only way to learn about them ?

SQL is a language (SQL means Structured Query Language actually); there are several standards of SQL, but unfortunately, every database vendor implements the language in his own way. Only the most basic commands (SELECT, INSERT, UPDATE, DELETE) work the same in (more or less) all databases, anything beyond that is usually at least a bit different in at least some databases. ("The same" is relative here, databases might different in details of their locking and concurrency mechanisms, so even if you build your multi-user application to contain only the most basic commands - and therefore be syntactically correct on a wide flavors of databases - it might still not work the same on all of the databases due to the locking/concurrency differences).

MySQL is a database which contains an implementation of the SQL language. There is a MySQL reference manual (if you know the SQL already, you can look up the concrete MySQL implementation features here).
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1624
    
  13

Joe Daly wrote:OK but after i read the head first SQL book how will i learn MySQL...

The book tells you how to install MySQL so I'm guessing it uses MySQL as the teaching platform. If not, most other "teach yourself databases" books use MySQL so just pick another book.

Joe Daly wrote:... and also will the online JDBC/MySQL documentation tell me how to set up a IDE for using JDBC?

No, that will probably be your IDE's instructions, but you'll also need to check the documentation for your JDBC driver to find out how to use it. JDBC connections work via a kind of URL, but the format of the URL is a bit different for each database/JDBC driver. So for example:

  • The JDBC URL "jdbc:mysql://127.0.0.1:3306/mydb" tells your MySQL JDBC driver to connect to the MySQL database named "mydb" which is listening for connections on port 3306 on the server with address 127.0.0.1 (i.e. your localhost).
  • The JDBC URL "jdbc:oracle:thin:@//127.0.0.1:1521/orcl" tells your Oracle JDBC driver to connect to the Oracle database named "orcl" which is listening for connections on port 1521 on the server with address 127.0.0.1.

  • Most JDBC drivers also accept additional parameters either via the URL or via connection properties supplied through your application e.g. DB username/password etc.
    Winston Gutkowski
    Bartender

    Joined: Mar 17, 2011
    Posts: 7553
        
      18

    Joe Daly wrote:OK but after i read the head first SQL book how will i learn MySQL and also will the online JDBC/MySQL documentation tell me how to set up a IDE for using JDBC?

    That's an awful lot of stuff you're mixing together there. Just to recap what's probably already been said:
    1. MySQL is a database.
    2. SQL is a language you use to extract information from the database.
    3. JDBC is the "glue" needed to connect your database to a Java program.
    4. Most major Java IDEs support JDBC, and they don't really care what type of database you're connecting to.

    whats the difference between SQL and MySQL, and is online the only way to learn about them ?

    1. See above.
    2. No.

    Winston


    Isn't it funny how there's always time and money enough to do it WRONG?
    Articles by Winston can be found here
    Joe Daly
    Ranch Hand

    Joined: Dec 18, 2012
    Posts: 45
    OK thank you all for the helpful answers i am appreciative, and can MySQL be used in web applications? , and i think i have setup a java application in netbeans that supports JDBC, so that's one problem solved.
    Winston Gutkowski
    Bartender

    Joined: Mar 17, 2011
    Posts: 7553
        
      18

    Joe Daly wrote:and can MySQL be used in web applications?

    Sure it can, but the question is kind of meaningless. It's a bit like asking whether you can use a saw to make a table.

    Answer: sure, with the right skills and equipment; but that doesn't mean that they have anything to do with each other.

    Winston
    chris webster
    Bartender

    Joined: Mar 01, 2009
    Posts: 1624
        
      13

    Joe Daly wrote:OK thank you all for the helpful answers i am appreciative, and can MySQL be used in web applications? , and i think i have setup a java application in netbeans that supports JDBC, so that's one problem solved.

    A web application typically consists of three layers (or tiers):

  • A front-end user interface which will run in your browser and is based on HTML/CSS/JavaScript (but also may be partly generated from server-side code like JSP or PHP etc).
  • A middle business tier on your application server, which contains your business logic and may be written in Java e.g. using servlets, or in any other language (PHP, Python, .NET etc).
  • A persistence tier which is typically a relational database like MySQL or Oracle, where your application's persistent data is maintained and can be manipulated via SQL.

  • Different application languages have their own drivers for talking to the database, but as you're interested in writing a Java application, you will be using JDBC drivers. But you can use the same 3-tier architecture for any web application, so there's nothing to stop you writing your business logic in Python instead and still using a MySQL database, because the three tiers are intended to be relatively independent from each other. Which is why it's a good idea to understand the difference between your MySQL database (and SQL) on the one hand, and your JDBC drivers and Java application code on the other, because they're separate technologies.

    The good news is that there are lots of books, online tutorials, tools and so on to help you build your first web application, in whichever language you want to use.
    Joe Daly
    Ranch Hand

    Joined: Dec 18, 2012
    Posts: 45
    chris webster wrote:
    A web application typically consists of three layers (or tiers):

    are you referring to MVC and if so, when i was reading the headfirst servlet and jsp book it said nothing about persistence or databases
     
    Don't get me started about those stupid light bulbs.
     
    subject: Need help learning about databases
     
    Similar Threads
    MySQL - Cant connect to server 127.0.0.1 (10051)
    how can find mysql database address?
    JDBC connectivity
    which DBMS to learn ??