Hi All...!
Today I'm going to show you how to create GUI to add users to over database. The following steps will guide you to do that.
1 Step
Creating or adding JFrame to our project.
Right click on the jdbc_demo package --> New --> JFrame form.
2 Step
Rename and create JFrame, rename new JFrame as AddUser
In the next post, we are going to add components to this JFrame and create the AddUser interface.
Tuesday, May 3, 2016
Thursday, April 28, 2016
JDBC (Java Database Connectivity)
Hi All...!
Today I'm going to show you how to connect to a Mysql database using Java code and execute some SQL queries. To do this coding parts I'm going to use the Java project we had created in the last lesson and the database we have to create in the 3rd lesson Create Mysql Database.
To connect the Mysql database to Java code we have to follow the following 4 steps.
Today I'm going to show you how to connect to a Mysql database using Java code and execute some SQL queries. To do this coding parts I'm going to use the Java project we had created in the last lesson and the database we have to create in the 3rd lesson Create Mysql Database.
To connect the Mysql database to Java code we have to follow the following 4 steps.
1.Load Mysql JDBC Driver
2.Create a Connection to "MySQL"
3.Create a Statement
4.execute "SQL string"
2.Create a Connection to "MySQL"
3.Create a Statement
4.execute "SQL string"
Let's do the coding,
Here you can see the basic parts of the code but there are some errors in this code let's fix them.
1. import java.sql.*;
2. throws ClassNotFoundException
3. throws SQLException
Just for a few upcoming posts, we import all classes and sub packagers in java.sql. Here we can catch or throws the above exception. Both of those options can fix the problem but it is not a good programming practice to catch exception here we must throw them to user interface and in the user interface we have to catch them.
Following is the corrected code
Let's run this code and insert data to the user table.
When you try to run this code you will get the following error.
This happens because we didn't add JDBC driver to the project yet let's add that,
Right-click on libraries
Then select add libraries,
Select Mysql JDBC Driver
Add the library. Run the code,
Let's take a look at the database,
We have successfully inserted the data to the table via Java code. Catch you guys in my next post bye..!
Saturday, April 23, 2016
How To Open New Java Application Project In Netbeans
Hi All...!
Today I'm going to show you how to open a new Java application project in Netbeans.
1) Click and open Netbeans IDE
2) Go to file
3) Click on New Project
Today I'm going to show you how to open a new Java application project in Netbeans.
1) Click and open Netbeans IDE
2) Go to file
3) Click on New Project
4) Select Java from categories
5) Then select Java Application from Projects
6) Then click "Next" and in the next window edit project name as you wish here I'm going to rename this project as JDBC_Demo
7) Then click on finish and netbeans will open main class of your project
Thursday, April 21, 2016
Create Mysql Database
Hi All...!
Today I'm going to show you how to create MySQL database which we are going to use for the next few lessons. From this post, I will use Netbeans IDE if you guys not familiar with Netbeans please read the following posts,
Netbeans
For this post and some upcoming posts, I will use following Mysql database.
Today I'm going to show you how to create MySQL database which we are going to use for the next few lessons. From this post, I will use Netbeans IDE if you guys not familiar with Netbeans please read the following posts,
Netbeans
For this post and some upcoming posts, I will use following Mysql database.
create database TestJDBC;
CREATE TABLE `testjdbc`.`user` (
`userID` VARCHAR(6) NOT NULL,
`name` VARCHAR(45) NOT NULL,
`age` INT NOT NULL,
PRIMARY KEY (`userID`));
I hope you guys create above database in your pc without any trouble. Catch you guys in my next post Bye......!
I hope you guys create above database in your pc without any trouble. Catch you guys in my next post Bye......!
Tuesday, April 19, 2016
Netbeans
Hi All...!
Today I'm going to show you how to download and install Netbeans IDE because I'm going to use NetBeans IDE to write programs hereafter.
Today I'm going to show you how to download and install Netbeans IDE because I'm going to use NetBeans IDE to write programs hereafter.
Download Netbeans IDE
Please go to the following link and download the complete Netbeans IDE.
https://netbeans.org/downloads/
Click the highlighted download button as shown in the above image. And wait until it finishes the downloading.
https://netbeans.org/downloads/
Then click on the downloaded file and install the IDE. The following images will show you how to set up the IDE correctly. Some features are not used for the JavaSE projects but keep then as I have shown in the following images those features will need to build JavaEE projects.
Hope you guys setup your IDE correctly, from next post we will start our JavaSE project. Catch you guys later Bye...!
Tuesday, April 12, 2016
Welcome
Hi All...!
This is my second blog about the Java programming language. In this blog, I wish to teach you guys how to create a Java SE desktop application project. People who are going to follow this blog to learn how to create a Java SE desktop application must have basic knowledge about the Java SE programming fundamentals and MySQL databases. Someone who doesn't have the basic knowledge about the Java please follow my Java Programming For Absolute Beginners blog and people who don't have basic knowledge about MySQL please follow this blog SQL for Absolute Beginners
Catch you guys in my next post bye.
This is my second blog about the Java programming language. In this blog, I wish to teach you guys how to create a Java SE desktop application project. People who are going to follow this blog to learn how to create a Java SE desktop application must have basic knowledge about the Java SE programming fundamentals and MySQL databases. Someone who doesn't have the basic knowledge about the Java please follow my Java Programming For Absolute Beginners blog and people who don't have basic knowledge about MySQL please follow this blog SQL for Absolute Beginners
Catch you guys in my next post bye.
Subscribe to:
Comments (Atom)



























