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()); } Below are the error messages. INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@36d64342: defining beans [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,dataSource,userAccountDao]; root of factory hierarchy com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: …

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 a stored procedure. This example will use Microsoft SQL Server, the java code for other databases is the same. If you do not know how to create stored procedures in Microsoft SQL Server, you can read the article JDBC CallableStatement Stored …

JDBC CallableStatement Stored Procedure Output Parameters Example Read More »

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 executing similar SQL commands repeatedly. This article will show you how to use the java.sql.PreparedStatement object to implement create table, insert, update or delete …

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