The web application [] appears to have started a thread named [Abandoned connection cleanup thread] com.mysql.jdbc.AbandonedConnectionCleanupThread

See this answer. It seems that MySQL driver should be in {$TOMCAT]/lib shared between applications. Check that you are not including it with each application. At least it worked for me and I have been able to remove the warning. If you are using Maven mark the dependency as provided. UPDATE: root cause is that … Read more

Why we use Class.forName(“oracle.jdbc.driver.OracleDriver”) while connecting to a database?

The basic idea behind using Class.forName() is to load a JDBC driver implementation. A (normal) JDBC driver must contain a static initializer that registers an instance of the driver implementation with java.sql.DriverManager: JDBC drivers must implement the Driver interface, and the implementation must contain a static initializer that will be called when the driver is … Read more

SPARK SQL – update MySql table using DataFrames and JDBC

It is not possible. As for now (Spark 1.6.0 / 2.2.0 SNAPSHOT) Spark DataFrameWriter supports only four writing modes: SaveMode.Overwrite: overwrite the existing data. SaveMode.Append: append the data. SaveMode.Ignore: ignore the operation (i.e. no-op). SaveMode.ErrorIfExists: default option, throw an exception at runtime. You can insert manually for example using mapPartitions (since you want an UPSERT … Read more

How to execute multiple SQL statements from java

you can achieve that using Following example uses addBatch & executeBatch commands to execute multiple SQL commands simultaneously. Batch Processing allows you to group related SQL statements into a batch and submit them with one call to the database. reference When you send several SQL statements to the database at once, you reduce the amount … Read more

Am I Using JDBC Connection Pooling?

Assuming that it’s the BasicDataSource is from DBCP, then yes, you are using a connection pool. However, you’re recreating another connection pool on every connection acquirement. You are not really pooling connections from the same pool. You need to create the connection pool only once on application’s startup and get every connection from it. You … Read more

JDBC: Simple MSSql connection example not working

OK, so here’s what solved my problems: Download latest MSSQL JDBC driver from here: http://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx Referenced the 2 JAR files in my project: sqljdbc.jar and sqljdbc4.jar (I’m not yet sure if both of the above are required or just one..) Make sure the SQL Server Browser windows service is running Open SQL Server Configuration Manager … Read more

No matter what, I can’t batch MySQL INSERT statements in Hibernate

It’s likely your queries are being rewritten but you wouldn’t know if by looking at the Hibernate SQL logs. Hibernate does not rewrite the insert statements – the MySQL driver rewrites them. In other words, Hibernate will send multiple insert statements to the driver, and then the driver will rewrite them. So the Hibernate logs … Read more