5 FREE JAVA VIDEO COURSES - CLICK HERE - https://goo.gl/7i95F8
---
View more videos on my "Java JDBC Tutorial" Playlist: http://goo.gl/crT4nS
Closed-Captioning and English subtitles available.
In this tutorial, you will learn how to connect to a MySQL database with Java.
Download source code from
- http://www.luv2code.com/2014/03/21/connect-to-mysql-database-with-java-jdbc/
Please subscribe to my channel. http://goo.gl/EV6Kwv
----
Follow luv2code:
Website: http://www.luv2code.com
YouTube: http://goo.gl/EV6Kwv
Twitter: http://goo.gl/ALMzLG
Facebook: http://goo.gl/8pDRdA
---
Join my mailing list: Get advance notice on new tutorials. Emails about 1 per week.
- http://www.luv2code.com/joinlist
---
Questions or problems? Post them in the comments section below.
---
Want to suggest a video? Leave a comment below. I'm always looking for new video ideas.
Let me know what video you'd like for me to create.
---
Video Transcript
Time - 00:00
Hello. In this tutorial, you will learn how to connect to a MySQL database with Java. In this session we’re going to learn how to connect a MySQL database with Java. Before we get started there are some prep work that needs to take place. One is that you need to have a MySQL database already installed. If not, you can download one from the site listed here on the slide.
Time - 00:20
Next, we’ll need to download and install a MySQL JDBC driver. This driver will allow the Java program to connect to the database. You can download it from this URL, and I’ll do that now. I’ll just take this URL, drop it into my favorite browser and here I am at the page. I’m on this page, this is for downloading the Connector/J browser. I’ll select the platform, platform independent. Now move down and I’ll select download and it will download a zip archive. Make sure you download the most recent version. In this case it’s 5.1.29. Make sure you download something at that version or later.
Time - 01:04
Download, scroll down, select, “No thanks, just start my download.” This will start downloading the file for you. Now what we can do is show it in the finder. I’ll double click it to extract it. At this point I have the driver extracted. There’s a file in here called MySQL connector.jar that we’ll use later.
Time - 01:34
Next, what I need to do is create a Java project in Eclipse. Let’s do that. On Eclipse I’ll say I’ll save file, new, Java project. This will be JDBC demo and I will select finish. What I’ll do is I will add a new class. New, class, this will be my driver and it will have a public static void main region. At this point we have a shell for our project created.
Time - 02:28
Next, what we’ll do is we will talk to the actual development process and I really like this slide because it outlines exactly what we need to do. The first thing we’ll do is add the database driver to the classpath. Next, we’ll get a connection, we’ll submit a SQL query and then we’ll process the result set.
Time - 02:48
Let’s start with step one, adding a MySQL database driver to the classpath. In our Eclipse project I’m going to add a new folder called lib, lib for library. In this lib folder I’m going to add the driver that I downloaded earlier. What I’ll do is I’ll just grab this driver. It’s the MySQL connector bin.jar and I’ll just drag and drop it to this lib folder. It will prompt me and I’ll say go ahead and copy the file.
Time - 03:25
Next, I need to add the jar file, the driver to the classpath. I’ve set this up with properties, choose Java build path and then I’ll choose add jars. Expand this folder, that lib, I’ll grab that jar file and I’ll have it setup. Great.
Time - 03:51
Now we can start coding. We need to get a connection, submit a SQL query and process a result set. Let me just sketch this out on a slide over here. The first thing I’ll do up top is I’ll just do an import on java.sql.* because all of the classes and interfaces that we need are in this package.
Time - 04:17
I’ll also just setup a try catch block just to handle for any exception that may occur. Small typo there.
Time - 04:40
Inside of this section I’m going to first get a connection to database. Then next I will create a statement. Then from here I will execute a SQL query and then I will process the result set.
Time - 05:16
That’s my basic game plan, let’s fill it in with some real code. Here I’ll say connection, myConn = DriverManager.getConnection. I’ll give the jdbc:mysql://localhost:3306/demo student, student. Student is the user ID and student is also the password.
[snip] Click the Transcripts tab for full transcript.

This video will provide a clear understanding of 4 Types of JDBC Drivers. How each Driver works and what is the advantage and disadvantage of each Driver For Complete JDBC Video Series : https://www.pluralsight.com/courses/jdbc-java-platform-working-with-databases
-~-~~-~~~-~~-~-
Please watch: "How to Enable and Disable Connection Pooling"
&rarr; https://www.youtube.com/watch?v=19OrWbwzysM
-~-~~-~~~-~~-~-

Download Java Source Code: http://www.luv2code.com/?p=992
In this video you will learn how to connect to MySQL with Java and NetBeans.
Please subscribe to this channel :-)
- https://www.youtube.com/user/luv2codetv?sub_confirmation=1
Video Transcript
Time - 00:00
Hi, this is Chad (shod) with luv2code.com. In this video, you will learn how to connect to MySQL with Java and NetBeans.
Time - 00:10
Let's go over the development process. The first thing we'll do is review the database tables, then we'll download and add MySQL database driver to NetBeans, then we'll actually create the Java code.
Time - 00:25
Let's look at our database and see what data we have. We'll move to the MySQL workbench tool. See that we have a table called Employees and then we'll do a select star from that table and we'll see that we have three employees currently in our database.
Time - 00:46
Now I'll create a simple NetBeans project. I'll go to the File menu, I'll select new Project. Make sure the Java application is selected and click next. For the project name, I'll give it jdbcdemo, I'll click Finish. Now what I'll do is I'll add a new Java Class. I'll select the project, I'll right click, I'll select New Java Class. For the name of the class I'll enter demo and hit finish. Now I have a basic Java Class ready to go.
Time - 01:26
I will show you how to download the MySQL database driver and add it to your NetBeans project. First thing we have to do is visit the MySQL website at dev.mysql.com. On this page, we'll choose the dropdown and we'll select the platform independent. We'll choose the second entry here, the ZIP Archive and we'll click the download button. On the next page right near the bottom, we'll say no thanks, just start my download. Then we'll save it to our local system.
Time - 02:07
Now let's move over to our Finder window on our file system and find the actual file that we just downloaded and I want to uncompressed it because right now it's a ZIP. I'll double click it, this will expand it or extract it. I'll look at it through list view. Now I have this new directory with the artifacts and there's a MySQL connector Java bin.jar, that's the actual JDBC driver that we'll use.
Time - 02:35
Now we need to copy this file to the NetBeans project directory. I'll right click, I'll select copy then I'll switch over to NetBeans, I'll click the files tab and I'll select my project and I'll right click and I'll say paste. Even though the file is copied over, we still need to tell NetBeans that this a JAR library that we'll use on our project. What I'll do know is I'll click on the projects tab, I'll go to libraries and I'll choose add library and now I'll navigate to that NetBeans project directory where I actually have the file stored. Jbdcdemo and MySQL connector Java bin and I'll select choose. Then I'll expand this library's folder and we'll see that now this MySQL Java driver is part of this NetBeans project.
Time - 03:37
Now let's start with the coding. The first thing I need to do is import Java to SQL package and then I'll drop in code for this main map it and then I'll walk through the code and show you how it works. This is our main map it, the main routine for the application. Then we have variables for the connection statement and result set. We also have the user id and password that we'll use.
Time - 04:03
Then the first step is getting a connection to a database. We'll use the URL, the user id and the password. Then we go through and we create a statement object. Then we use this statement object to execute SQL query, select star from employees, then we'll process the result set and we'll simply print out the last name of the employee along with the first name. We have our accession handler and then we also clean up our resources at the end once we're done.
Time - 04:42
Then to actually run the application, we will right click, select run file and at the bottom we have our output. We have our three employees that were listed in the database and our Java program was able to access it successfully. Great.
Time - 04:59
Okay so this wraps up our video. You learned how to use NetBeans to connect to a MySQL database. Please subscribe to our channel to view more videos on Java, click thumbs up to like our video. Also visit our website luv2code.com to download the Java source code used in this video.

download mysql-connector.jar file
https://goo.gl/ftjWmK
if this video really helped you then you can help me out by Donatation me on PayPal paypal.me/Tarique1
For connecting java application with the mysql database, you need to follow 5 steps to perform database connectivity.
In this example we are using MySql as the database. So we need to know following informations for the mysql database:
Driver class: The driver class for the mysql database is com.mysql.jdbc.Driver.
Connection URL: The connection URL for the mysql database is jdbc:mysql://localhost:3306/test where jdbc is the API, mysql is the database, localhost is the server name on which mysql is running, we may also use IP address, 3306 is the port number and test is the database name. We may use any database, in such case, you need to replace the test with your database name.
Username: The default username for the mysql database is root.
Password: The default password for the mysql database is ""(blank).Password is given by the user at the time of installing the mysql database. In this example, we are going to use "" as the password.
Let's first create a table in the mysql database, but before creating table, we need to create database first.
create database test;
use test;
create table tblogin(UserName varchar(10),Password varchar(40));
-----------------------------------
The above example will fetch all the records of tblogin table.
To connect java application with the mysql database mysqlconnector.jar file is required to be loaded.
download the jar file mysql-connector.jar
Two ways to load the jar file:
paste the mysqlconnector.jar file in jre/lib/ext folder
set classpath
1) paste the mysqlconnector.jar file in JRE/lib/ext folder:
Download the mysqlconnector.jar file. Go to jre/lib/ext folder and paste the jar file here.
2) set classpath:
There are two ways to set the classpath:
temporary
permanent
How to set the temporary classpath
open command prompt and write:
C: set classpath=c:\folder\mysql-connector-java-5.0.8-bin.jar;.;
How to set the permanent classpath
Go to environment variable then click on new tab. In variable name write classpath and in variable value paste the path to the mysqlconnector.jar file by appending mysqlconnector.jar;.; as C:\folder\mysql-connector-java-5.0.8-bin.jar;.;

5 FREE JAVA VIDEO COURSES - CLICK HERE - https://goo.gl/7i95F8
---
View more videos on my "Java JDBC Tutorial" Playlist: http://goo.gl/crT4nS
Closed-Captioning and English subtitles available.
In this video tutorial, we will present an overview of Java JDBC. We discuss the following topics:
- What is JDBC?
- Features
- Database Support
- Architecture and API
- Development Process
----
Follow luv2code:
Website: http://www.luv2code.com
YouTube: http://goo.gl/EV6Kwv
Twitter: http://goo.gl/ALMzLG
Facebook: http://goo.gl/8pDRdA
---
Join my mailing list: Get advance notice on new tutorials. Emails about 1 per week.
- http://www.luv2code.com/joinlist
---
Questions or problems? Post them in the comments section below.
---
Want to suggest a video? Leave a comment below. I'm always looking for new video ideas.
Let me know what video you'd like for me to create.
---
Video Transcript
Time - 00:00
In this video, I will provide an overview of Java JDBC. We will cover the following topics. What is JDBC? We'll also discuss the features of JDBC in terms of SQL statements. Then we'll see the databases that are supported. Next, we will cover the architecture and API of JDBC. Finally, we will walk through the development process for executing a simple query.
Time - 00:32
JDBC allows a Java application to connect to a relational database. The major databases are supported such as Oracle, Microsoft SQL Server, DB2 and many others. The database can be located on the same local machine as in the application. It can also be located in a network in a remote location. The database can also be deplored in the Cloud. No worries, JDBC can still give you to a connection to the database regardless of the location.
Time - 01:08
The main feature of JDBC is that it is a standard API. You develop your application code to the JDBC API and you can connected to various databases. There's no need to develop code for different databases. That's the main advantage of JDBC. JDBC is a call level interface that supports ANSI SQL 2003. When you provide SQL statements to the JDBC driver, it simply passes the SQL to the database. You can make use of SQL to perform select, insert, update and delete.
Time - 01:43
You can also build complex SQL series queries with inner and outer joins. You can also make calls to store procedures on the database. As you can see, JDBC does not place any limitations on your SQL development. You are free to leverage ANSI SQL 2003 to meet your application requirements.
Time - 02:04
Here's a nice graphic of the databases that are supported by JDBC. As you can see, there's support for Oracle, My SQL, Informix, DB2, SQL Server, Sybase, PostgreS and many others. Note, this is not an exhaustive list. You can simply visit the URL here to see a complete list of databases.
Time - 02:26
The JDBC architecture includes a key component which is the JDBC driver. The JDBC driver provides the critical link between your Java application and the database. The driver converts the standard JDBC API calls to low level calls for your specific database. There are multiple JDBC driver implementations. Your database vendor normally provides the JDBC driver. Simply visit the database vendor's website and search for the words JDBC driver. The vendors will provide the link to download the driver along with supporting documentation on how to connect to the database.
Time - 03:06
Another key player is the driver manager. The driver manager helps connect and app to the database based on a database connection stream. The current version of JDBC is version 4.0. with this latest version, the driver manager will automatically load JDBC drivers that are in the application's classpath. No additional work is required by the developer.
Time - 03:36
Most JDBC drivers are now JDBC 4.0 compliant. However, there are Legacy JDBC 3.0 drivers that have to be specifically loaded with Java code. That Java code is class.forname and the actual driver name. The JDBC API is defined in two packages. java.sql and javax.sql. The key classes in the API are driver manager, connection, statement, results set and data source.
Time - 04:16
Great. We've covered a lot of the theory, a lot of the key concepts and classes. Now, let's walk through an actual development process for a simple query. The process is, step one, we'll get a connection to a database. Then in step two, we'll actually create a statement object. Then step three, we'll execute a SQL query. Then finally in step four, we'll process the results set.
[snip]
click the Transcript tab for complete transcript.

Java Tutorial, how to insert data into oracle database using jDBC with eclipse IDE.
Write sample java program using eclipse IDE : https://www.youtube.com/watch?v=_6x8F02pwyE
Swapping 2 number without using third variable in java : https://www.youtube.com/watch?v=HXVPu0_6UKw&t=25s

How to resolve java.lang.ClassNotFoundException: com.mysql.jdbc.Driver error?
In this video tutorial I have explained you the reason of the java.lang.ClassNotFoundException: com.mysql.jdbc.Driver error and also explained you how to resolve the error?
The error java.lang.ClassNotFoundException: com.mysql.jdbc.Driver comes in a Java application when there is no MySQL JDBC driver present in the application. View the complete details of the tutorial at http://www.roseindia.net/jdbc/javalang-ClassNotFoundException-com-mysql-jdbc-Driver.shtml

In this video you will learn
1. how to connect java program with Oracle database.
2. Implement #type_4 connectivity.
3. Set #classpath of oracle #JDBC #Driver.
4. Run sql commands using java program.
Like , Share And Subscribe to our channel

how to connect mysql database with java netbeans || java tutorials for beginners || by Saurabh Talathi
Here I have explained all the functions on jdbc driver .Basically we connect mysql database with netbeans application using MYSQL-JDBC DRIVER .
Here I have created login application in which I am checking username and password entered by user to mysql data.
This document demonstrates how to set up a connection to a MySQL database from the NetBeans IDE. Once connected, you can begin working with MySQL in the IDE's Database Explorer by creating new databases and tables, populating tables with data, and running SQL queries on database structures and content. This tutorial is designed for beginners with a basic understanding of database management, who want to apply their knowledge to working with MySQL in NetBeans IDE.
you can watch our videos:
how to go from one frame to another frame in netbeans
https://youtu.be/kIA_jZDmUfU
Facebook: https://www.facebook.com/talathisaurabh
Instagram: http://instagram.com/saurbhtalathi
In this video i have shown how to connect mysql database with netbeans java
Eclipse IDE for Java EE Developers: http://goo.gl/Ppyt8R
subscribe our channel if you want to watch more videos ;
like and share

Prior to JDK 1.8, you could have used a JDBC-ODBC Bridge to read an MS Access database (.mdb or accdb file), however this only would work in a Windows environment and you needed to be careful about 32-bit vs. 64-bit environment.
UCanAccess is a Java package that is pure Java/JDBC UCanAccess-A Pure Java JDBC Driver for Access. UCanAccess works for all OS as it is a java package.
It should allow you to work with an MS Access database (collection of tables, etc.) directly from Java without need for the ODBC bridge.
download link for UCanAccess package -
https://sourceforge.net/projects/ucanaccess/

From the above video you can understand how to write java code to select rows from table using SQL Select statement.
Steps to Write Code.
1. The very first step is to Load the JDBC-MySQL Driver.
try {
Class.forName("com.mysql.jdbc.Driver");
}catch(Exception e){
}
The above java code will load the driver using try-catch statement, because the Class.forName() method will throw class not found Exception.
2. Second Step is to Establish the Connection
try{
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/simpledb", "root", "123");
}catch(Exception e){
}
The above java code will establish the connection to the database "simpledb" using its user: root and password: 123
3. Third step is to create an SQL statement and pass to "simpledb"
try{
String sql = "select * from emp";
Statement stmt = conn.createStatement();
ResultSet res = stmt.executeQuery(sql);
}catch(Exception e){
}
The above code snippet will pass SQL statement to the database and obtain rows of "emp" table. The rows obtained will be stored in the ResultSet object.
4. Fourth step is to query the ResultSet object. and to print output.
For more tutorials visit: http://www.step2know.com

NEED TO LEARN JAVA? - 5 FREE JAVA VIDEO COURSES - CLICK HERE - https://goo.gl/7i95F8
---
View more videos on my "Java JDBC Tutorial" Playlist: http://goo.gl/crT4nS
Download Java Source Code: http://www.luv2code.com/?p=1057
Follow Me on Twitter: https://twitter.com/luv2codetv
Please SUBSCRIBE to this channel: https://www.youtube.com/user/luv2codetv?sub_confirmation=1
---
In this video tutorial we will learn how to use JDBC to read and write BLOB with MySQL.
---
Transcript
Time - 00:00
Hi, this is Chad (Shod) with luv2code.com. Welcome back to another tutorial on Java JDBC. In this video we're going to learn how to read and write BLOBs. For this tutorial we're going to use the employees table. I have a SQL script that will create the table and add sample data for you. You can download it from the link below. The file is sql/table-setup.sql.
Time - 00:28
So what exactly is a BLOB? Well a BLOB is basically binary data that we store in the database. You normally use BLOBs to keep track of documents, images, audio, or any other binary object that you have. Note that not all databases have support for BLOBs. In this example we’re going to make use of MySQL and they have BLOB support.
Time - 00:48
On this slide we will learn how to create a BLOB column. So when we create a table in MySQL we add a column with the BLOB data type. On this slide I want to learn how to write a BLOB to a database. For this example I'm going to add a resume for an employee. I'm going to read a local PDF file and I'll take that file and update the database with the binary data that's the actual content of PDF file. Let's walk through the code.
Time - 01:17
At the beginning I’ll set up a SQL statement. I’ll say update employees set resume equals to question mark where the email address equals [email protected] We’re only going to make a change for this John Doe employee, set up a prepared statement, and then I go, we’re going to create a file that's an actual handle to the local file sample_resume.pdf. Then I’ll set, on my statement I’ll set the binary stream, that first parameter for the resume comma the input. That's the input stream I have for that file. Then I actually call my statement .executeUpdate. That will actually update the database with the binary data.
Time - 01:54
All right so let's switch over to Eclipse and let’s look at a very simple demo. I have a program called WriteBlobDemo. In this program we're going to actually read a resume from a local file system and write it as a BLOB to the database. I’ll walk through the code here. The first thing we do is we get a connection to the database. We prepare a statement. We're going to update employees, set resume equals to question mark where email equals [email protected] So we’re going to update the resume for John Doe.
Time - 02:22
Then I’ll move down, I’ll set up a file handle for this file sample_resume.pdf. I’ll set up an input stream on that file and then I’ll set that as the parameter for our binary stream for our prepared statement. Then I’ll move through and I’ll actually do an execute update. This will actually store this binary file from the file system into the actual database column.
Time - 02:47
I just ran the application and here's the output of the program. So beginning it says that it’s reading the file and gives me the full path to the file just for sanity sake, I know which file is actually reading. Then it tells me that it's storing the resume in the database for our employee [email protected] and then it says that it completed successfully. Excellent.
Time - 03:10
Now let's move over to MySQL tool and verify this. I'll take a look at the employees there in the database right now. l’ll run this query select * from employees and I'll get a list of the actual employees. Notice here for John Doe there’s an entry here for a resume, there's a BLOB entry. Note all the other entries are null. So we have a BLOB entry here. I can select this entry. I can right click. I can say, “Open Value in Editor” and it’s going to show me this BLOB. Again, it's a binary large object so we see all this binary data. Actually it should be displayed as hex.
Time - 03:50
Instead of looking at it in this fashion there's a tab here called “Image.” I can select this tab and now it'll actually show me this image or the actual data as a PDF that I can view. This is the actual PDF document for this employee, John Doe. This looks really good. We know that we were successful in storing the BLOB in the actual database.
Time - 04:18
Now that we know how to write BLOBs in the database let's learn how to read a BLOB from the database. In this example I'm going to read the employee’s resume from the database as a BLOB and then store it as a file on my local files system. Let's walk through the code.
[snip] .... see the Transcripts tab for details.

The effective home remedies for baldness and hair loss in men include oil massages and including coconut milk, eggs, avocados, orange juice, aloe vera, neem paste, henna, mayonnaise, honey, black pepper, vinegar, and lemon juice in their diet. The remedies also include cutting back on red meat, eating nuts and brown rice, boosting B-complex vitamin intake, and maintaining good thyroid health.
For millions of men across the world, regardless of culture, class, nationality, religion, or color, hair loss is an unavoidable aspect of growing older. Fortunate are those who do not face hair loss problems even in their old age. However, a majority of men face this issue in their 40s, 50s, or even earlier.
Causes of Baldness or Hair Loss in Men.

There are a number of causes of male hair loss, including:
Male pattern baldness Alopecia Fungal infections Psychological disorders Chemotherapy side effects Nutrient deficiencies Hormonal imbalances Lack of circulation on the scalp Stress.
It is important to note that hair loss occurs in women as well, for some similar reasons, and some different ones. We will cover hair loss in women in a separate article. Men predominantly suffer from this health condition, particularly male pattern baldness and early onset hair loss from age 20-40.
However, there are ways to slow down the rate of male hair loss or baldness, and even stimulating the hair follicles to reproduce hair. A few home remedies for hair loss and baldness issue are discussed below.