JDBC Tutorial

mysql jdbc 08001 could not create connection to database server

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.s[email protected]36d64342: 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 »

Use JDBC To Connect Microsoft SQL Server

This article will tell you how to connect Microsoft SQL Server use JDBC. You can access Sql Server use JDBC with following two methods. Use com.microsoft.sqlserver.jdbc.SQLServerDataSource java object. SQLServerDataSource sqlDs = new SQLServerDataSource(); // Use window integrate authentication. //sqlDs.setIntegratedSecurity(true); /* Use sql server account authentication.*/ sqlDs.setIntegratedSecurity(false); sqlDs.setUser(“sa”); sqlDs.setPassword(“sa”); // Set ds server name or ip. …

Use JDBC To Connect Microsoft SQL Server 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 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.