tags:

views:

48

answers:

4

I need sample code to read rows of data from a mysql table using java

A: 

A very simple tutorial: http://www.vogella.de/articles/MySQLJava/article.html

Google is your friend.

The Elite Gentleman
A: 

I wouldn't recommend using the JDBC API directly, it's error prone (sooner or later you forget to close a conection) and too verbose. There are many nice layers to use on top of JDBC. If you want to write SQL, I think Spring JDBCTemplate is nice. Or better, Groovy's SQL support (if you are just bound to 'Java the platform', not 'Java the language').
Then there are object relational mappers (ORM) where you don't need to write SQL. Take a look at Hibernate and JPA

rlovtang
You're forgetting that the company writing database drivers uses JDBC.....
The Elite Gentleman