Getting there vs. MSSQL with JDBC
Posted by: David Wynter
Date: April 08, 2005 10:28AM

Well it turns out 3.1.6 was on the classpath not 3.1.7. Now that i have 3.1.7 it is using Server Side Prepared Statements. So I am hitting 830 of my parent-child-grandchild denormalised records processed every minute, about 1/2 the performance of MS SQL. If the multi value INSERTS work with Prepared Statements then it may beat the MS SQL performance.

I added a test to the testsuite, but the ant tasks do not seem to have a target that equates to simply running the testsuite with the current JVM, a shame. The std target fails with:
C:\Program Files\MySQL\mysql-connector-java-3.1.7\build.xml:579: C:\Program File
s\MySQL\mysql-connector-java-3.1.7\lib-nodist not found.

here is my test anyway

public void testPreparedStatementMultiInsert() throws SQLException {
this.pstmt = this.conn.prepareStatement(
"INSERT INTO statement_test (id, strdata1, strdata2) values (?, ?, ?), (?, ?, ?)");
this.pstmt.setInt(1, 999);
this.pstmt.setString(2, "ghijklmn");
this.pstmt.setString(3, "poi");
this.pstmt.setInt(4, 111);
this.pstmt.setString(5, "abcdefg");
this.pstmt.setString(6, "shmoi");

int updateCount = this.pstmt.executeUpdate();
assertTrue("Update count must be '2', was '" + updateCount + "'",
(updateCount == 2));

this.pstmt.clearParameters();

this.pstmt.close();

this.rs = this.stmt.executeQuery(
"SELECT id, strdata1, strdata2 FROM statement_test");

assertTrue(this.rs.next());
assertTrue(this.rs.getInt(1) == 999);
assertTrue("Expected 'ghijklmn', received '" + this.rs.getString(2) +
"'", "ghijklmn".equals(this.rs.getString(2)));
assertTrue("Expected 'poi', received '" + this.rs.getString(3) + "'",
"poi".equals(this.rs.getString(3)));
assertTrue(this.rs.next());
assertTrue(this.rs.getInt(1) == 111);
assertTrue("Expected 'abcdefg', received '" + this.rs.getString(2) +
"'", "abcdefg".equals(this.rs.getString(2)));
assertTrue("Expected 'shmoi', received '" + this.rs.getString(3) + "'",
"shmoi".equals(this.rs.getString(3)));
}

Might just add support to my code and try it.

David

Options: ReplyQuote


Subject
Written By
Posted
Getting there vs. MSSQL with JDBC
April 08, 2005 10:28AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.