i need to write a program in java that will connect to a mysql database and execute some sql queries and display the result. suggest me a link with similar implementation / discussion of such concepts for guidance.
Investigate object-relational mapping (ORM) libraries such as Hibernate. They encapsulate the JDBC API in a way that simplifies coding.
I would look here: http://dev.mysql.com/usingmysql/java/ you will need the connector jar from mysql. And then a basic jdbc tutorial from sun here: http://java.sun.com/docs/books/tutorial/jdbc/index.html
First start with the JDBC tutorial to learn the generic JDBC concepts. You can consult the MySQL JDBC documentation for more MySQL-specific details such as how to create a connection string and more JDBC code examples. As next step you can learn the DAO pattern how to manage your JDBC code nicely. If you want to go more further, then you can take a look for JPA.
Probably the easiest would be to use the predefined Desktop Database Template included with NetBeans.
It's based on the Swing Application Framework.
Benefits:
- drag and drop GUI
- all the pre-wiring is done. I mean... it would be hard to make more simple.
NetBeans is not my favourite IDE but I must admit they have really nice tutorials and screencasts, especially for beginners.
So, you could maybe start with Connecting to a MySQL Database. Then, have a look at Creating a Simple Web Application Using a MySQL Database. If you are more into Swing, maybe you'll prefer NetBeans Platform CRUD Application Tutorial.
Without more details on the technologies you want to use and the type of application you want to build, it's actually hard to provide more guidance.