JDBC Tutorial

How To Fix MySQL JDBC 08001 Database Connection Error

When you use MySQL JDBC driver to connect to MySQL database server. You may encounter bellow error messages. try { Connection connection = DriverManager.getConnection(“jdbc:mysql://localhost:3306/dev2qa?useSSL=false”,”test”,”666888″); } catch (SQLException ex) { ex.printStackTrace(); System.out.println(“SQL State : ” + ex.getSQLState()); } INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.[email protected]: defining beans [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,dataSource,userAccountDao]; root of factory hierarchy com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to …

How To Fix MySQL JDBC 08001 Database Connection Error Read More »

JDBC CallableStatement Stored Procedure Output Parameters Example

This example will show you how to use java.sql.CallableStatement to get output data from stored procedure. This example will use Microsoft Sql Server, the java code for other databases is same. If you do not know how to create stored procedure in Microsoft Sql Server, you can read article JDBC CallableStatement Stored Procedure Input Parameters Example first.

JDBC PreparedStatement Example – Create Table And Insert, Update, Delete Records

java.sql.PreparedStatement is a more powerful database operation class than java.sql.Statement. You can send a pre-compiled SQL statement to the database server with specified parameters. It is more efficient than java.sql.Statement  when execute similar sql commands repeatedly. This article will show you how to use java.sql.PreparedStatement to implement create table, insert, update or delete records from MySQL Server.