Caché JDBC Examples PDF Print E-mail

Here you find some examples and code samples using JDBC with Caché.




Simple example to connect to the database:

try
{
Class.forName("com.intersys.jdbc.CacheDriver");
final String URL = "jdbc:Cache://localhost:1973/USER";
System.out.println("Start with URL: " + URL);
Connection con = DriverManager.getConnection(URL, "_SYSTEM", "SYS");

// do some work

con.close();
}
catch (Exception e)
{
e.printStackTrace();
}



I have done some performance testing between different types of inserting data into the Caché database. The three different types i have tested are:

  1. INSERTs as simple executeUpdate()

  2. INSERTs as PreparedStatements

  3. INSERTs as PreparedStatements with Batch

For 5000 inserts on my laptop with Caché 5.2 the difference is huge, see here:

  1. 1109 ms
  2. 750 ms
  3. 141 ms

(Auto Commit is set to true)

I will do soon some testing with the java binding.

Here the test Code: