Showing posts with label Database. Show all posts
Showing posts with label Database. Show all posts

Monday, 29 July 2019

MySQL stored procedure parameters IN OUT INOUT | How to use parameters in MySQL procedure

                   In this post, we will see MySQL stored procedure parameters IN OUT INOUT.
                   In last post https://www.comrevo.com/2019/07/how-to-create-procedure-in-mysql-database.html, we have seen how to create procedure in MySQL. In this post, we will see how to use parameters in procedure.

For Details, Watch Following Video:

Thursday, 25 July 2019

Java MySQL CallableStatement Example | Java MySQL Call Stored Procedure Example ( Callable Statement )


                      In this post, we will see Java MySQL CallableStatement Example OR Java MySQL Call Stored Procedure Example ( Callable Statement ).

How to create procedure in MySQL database?

                 In this post, we will see how to create procedure in MySQL database. 
             
What is the need of procedure?

1. By creating procedure, we can run multiple SQL queries in a single call. 

2. Another advantage is that procedure is stored and can be called at any time. No need to write same SQL queries again and again. 

For Demonstration, watch following video:

Watch on YouTube: https://www.youtube.com/watch?v=02clWrruoKE

                 Check following example:

Java MySQL Insert Example using Prepared Statement

                      In this post, we will see Java MySQL Insert Example using Prepared Statement.

                In previous post https://www.comrevo.com/2017/07/jdbc-code-to-insert-data-into-mysql-database.html, we have seen how to insert records (rows) into MySQL database. Here, we will see how to use PreparedStatement. 

For details, watch following video:

Watch on YouTube: https://www.youtube.com/watch?v=S6mJpp5Dg7c

What is the need of Prepared Statement?:
               Sometimes we need to implement same query multiple times e.g. insert query to add multiple records into table. In this situation, only data get changed while the syntax for SQL query remains same. Here, unnecessarily we compile the same query multiple times. To avoid this, we have to use PreparedStatement.

What is PreparedStatement?
               PreparedStatement is an Interface. Stament interface is extended in PreparedStament interface.

               Here sdldb is the database name. User name is sdl and password is sdl123. This program is for inserting records (rows) into MySQL database table student.
              

Tuesday, 16 July 2019

Solution for Mysql error: access denied for user 'root'@'localhost'

                  In this post, we will see solution for the mysql error access denied for user 'root'@'localhost'. 

Thursday, 20 July 2017

Basic steps in jdbc code

                       In this post, we will see the basic steps in jdbc starting from connection with database to the execution of SQL queries, Basic Steps in JDBC Code | Standard Steps of Developing JDBC Application |Java Database Connectivity | basic steps in jdbc code,standard steps of developing jdbc application,jdbc code,jdbc code in java,java database connectivity,java database connection jdbc and mysql

Watch this video to know about Basic steps in JDBC Code:


Watch on YouTube: https://www.youtube.com/watch?v=vsv62tuO4LI

                      Following are the basic steps:

Wednesday, 19 July 2017

What are types of jdbc drivers?

                    In this post, we will see different types of jdbc drivers, JDBC Driver Types in Java | Database Driver Types | Types of Database Drivers | JDBC Drivers in Java | jdbc driver types in java,database driver types,types of database drivers,jdbc drivers,jdbc drivers in java,jdbc driver for mysql,jdbc driver types

Watch this video to know JDBC Driver Types in Java:


Watch on YouTube: https://www.youtube.com/watch?v=QfcfWnBUWK4

                    A jdbc driver is a connecting bridge between Java application and Database. It implements the jdbc interfaces targeting a specific Database.




                    There are four types of jdbc drivers as follows:

how to avoid java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

                  Hi, in this post we will see how to avoid exception java.lang.ClassNotFoundException: com.mysql.jdbc.Driver.

                  If you are running jdbc program on terminal in Linux; you may get following error:

How to run jdbc program in command prompt in linux

                In this post, we will see how to run jdbc program in terminal or command prompt in Linux. Here we have used mysql database.

Watch following video:


                Follow the following steps.

jdbc code to insert data into mysql database

                     In this post, we will see a Java Database Connectivity program (JDBC) for inserting data (record or row) into the table in 'mysql' database.

               Here 'sdldatabase' is the database name. User name is 'sdl' and password is 'sdlpassword'. This program is for retrieving records (tuples) from table 'student' which has four fields (columns).
               Following are the SQL queries implemented on SQL prompt followed by JDBC program for inserting data. Go through them.


Tuesday, 18 July 2017

jdbc code to retrieve data from mysql database

                     In this post, we will see a Java Database Connectivity program (JDBC) for selecting records or retrieving data from the table in 'mysql' database.

               Here 'sdldatabase' is the database name. User name is 'sdl' and password is 'sdlpassword'. This program is for retrieving records (tuples) from table 'student' which has four fields (columns).
               Following are the SQL queries implemented on SQL prompt followed by JDBC program for retrieving data. Go through them.


Saturday, 26 December 2015

Mysql Tutorial - Basic SQL Queries

               In this post (tutorial), we will see basic sql queries which we need for database (e.g. Mysql) operations. 

Thursday, 23 July 2015

How to add multiple records to Database using single HTML Form

              In this post, I have given sample program for adding (inserting) multiple records to Database using single or same form in HTML.
             For this, you have to use table in HTML form. Go through the following HTML code:

Monday, 20 July 2015

How To Use Multiple Resultset in JAVA / JSP

              In this post, I have given sample program for using multiple ResultSet objects in the same Java program.
              Here I have written code in JSP. Database used is Mysql. Mysql database name is "test". Database User name is "test" while password is "123".
              In same Java program, when we have to use two ResultSet objects, we have to use two Statement objects with only one Connection object. It is shown in following program followed by output webpage.
              Here, I am retrieving records from two tables, "firsttable" and "secondtable". Their configuration is shown in following tables:


Sunday, 12 July 2015

How to insert data into mysql database using Java-JSP

                        In this post, I have given a program for how to insert data into the mysql table using Java (JSP).
                        Here, frontend and backend programs are in JSP while database used is Mysql. Database name is "test", Database user name is also "test" and password is "123". Table name in which I have inserted data here is syllabusplanpmcd4. Table's configuration is shown in following table:

Saturday, 20 June 2015

How to retrieve data from mysql database in jsp ( JSP-JDBC selecting records from mysql database )

               In this post, I have given Java Database Connectivity program (in JSP) for selecting records or retrieving data from the table in 'mysql' database.
               Here 'test' is the database name in mysql. User name is 'test' and password is '123'. This program is retrieving records (tuples) from table 'syllabusplanpmcd4' which has four fields (columns).