divesh premdeep
divesh premdeep

Reputation: 1070

Is MySQL JDBC driver compliant with the JDBC spec?

I am using Connector/J 5.1.10 as the JDBC driver for my Database application (which uses MySQL).

I have found that although the default ResultSet returned by a Statement is of type TYPE_FORWARD_ONLY, I am still able to safely call the previous() method on the ResultSet.

I also looked at the source code (com.mysql.jdbc.ResultSetImpl), and found out that it too does not do any checks for the type of the ResultSet.

Is Connector/J not fully compliant with the JDBC spec ?

Thanks.

Upvotes: 2

Views: 568

Answers (2)

jarnbjo
jarnbjo

Reputation: 34313

The API documentation says that ResultSet#previous() should throw an SQLException "if ... the result set type is TYPE_FORWARD_ONLY", so I guess it's safe to assume that J/Connector violates the specification here.

Upvotes: 1

Yoni
Yoni

Reputation: 10321

According to the release notes the driver is compliant with all of the tests that Sun makes publicly available.

Some parts of the spec are vague, mysql specifically says so in the release notes. Perhaps the spec doesn't say what the vendor should do if you traverse back on a forward_only cursor ... the vendor has a choice whether to throw an exception at you or not.

The public tests can't test the parts of the spec where a decision is left to the vendor's discretion.

Upvotes: 1

Related Questions