Manage Information from a database with Java . JDBC MySql.

With this tutorial you can make four programas wich can connect to a database and with queries , like delete, update , insert or select , manage this information and use it in your aplication .
First of all you need to a databe with at least one table . This time we are going to work with mysql . This is my table :

You need to add new user with all privileges . You can use this command line :
Library ->add Library add Mysql JDBC Driver



GRAN ALL ON hereyourdatabase. * TO hereyouruser IDENTIFIED BY “hereyourpass”;
Now go NetBeans , first of all we need add the controller you our Project :









After this we can start to write code , we need to import java SQL tolos::
import java.sql.*;
Everytime you want to manage information in a database from java you need 3 things:
A Connection to our database
A Statement with the query
A Resulset to retrieve the information and show it

The only thing that changes will be the sentence , the query.

Query SELECT :

Query UPDATE :

Query INSERT :

Query DELETE :

Acerca del autor: Start2Develop

Dejar una contestacion

Tu dirección de correo electrónico no será publicada.