The document discusses improvements made to the Informix Java Driver (JDBC). It summarizes that the driver was modernized by: 1) Shortening build and test times from hours to minutes; 2) Adding over 100 new tests and API features for JDBC 4.0 compliance; and 3) Publishing the driver to Maven to simplify access and updates. Key changes included refactoring tests, adding metrics for quality, and allowing streaming of large objects from JDBC result sets.
3. Internal Improvements
• Re-investing in the driver
– Modernizing how we build and test the JDBC
driver essential for adding more value
• Prior model was “isn’t broken, don’t fix it”
– Though it wasn’t broken it was slow process to
build and test new versions of the driver
• Few metrics
– Pass rates and build time was all that was
available
3
4. Internal Improvements
• Focus areas
– Faster turnaround time (fail fast)
– More information (metrics)
– Better testing (coverage, ease of use)
– Portability (build on any machine with little setup)
4
5. Failing Fast
• Build + test for the JDBC driver took almost 2
hours before
– Ran on a cron job that ran once a day
• Could do some testing locally before checkin,
but most validation came with the overnight
testing
• Build and test needed an overhaul
5
6. Failing Fast
• Ported all tests into TestNG (Java unit test
framework)
• Setup so we can run tests locally or on a ‘build’
machine
• Switched from perl scripts (yes we used perl) to
Gradle for building the driver
• Build time
– 4.10.JC7 - 40 minutes
– 4.10.JC8 - 3 minutes
• Test time
– 4.10.JC7 – 45 minutes
– 4.10.JC8 – 10 minutes
6
7. More Information (Metrics)
• Metrics are useful guides to indicate problem
areas or trends in code quality
• Coupled with testing and user feedback
metrics can alert us to potentially dangerous
or high risk additions to the product early on.
7
8. Metics
• Warnings
– over the years Java and code practices introduced
a number of warnings into the code
– even benign ones clutter and obscure potentially
dangerous warnings
• Code coverage
– How well does our testing cover the product, is
the coverage in the right areas?
– Very important for refactoring code, adds
confidence we didn’t break anything
8
9. Metics
• Static code analysis
– Augments testing with scans of the source code
for patterns that indicate potential problems
– Can be a little noisy with false positives
• Code complexity
– Identifies complex code blocks (nested
if/while/switch blocks)
– Points out interdependencies between
components
– Complex code === buggy code
• Also good points for refactoring the code
9
10. The Value
• All these pieces come together to allow faster
product development
• Case study 4.10.JC8
– Added ~100 tests
– Added ~100 new API’s
– Reduced compilation warnings by 1200
– Increased test coverage
10
11. 4.10.JC8 Features
• JDBC 4.0 Compliance
– Almost a hundred new API’s implemented or
enhanced to provide 4.0 compliance
– Compliance doesn’t mean all JDBC methods
supported
• We will go through the some of the more
interesting/useful
11
12. 4.10.JC8 Features
• ResultSet
– isClosed() and getHoldability()
– update* methods now work with long values
– Before this was what you had
• resultSet.updateBlob(“blobcolumn”, inputStream, int length);
– Now you can also use
• resultSet.updateBlob(“blobcolumn”, inputStream, long length);
– Before 4.10.JC8 you couldn’t always send an input stream
that didn’t have a length specified, now you can
• resultSet.updateAsciiStream(“charcolumn”, new
FileInputStream(“/myfile.txt”));
– This was done for all resultset update API’s
12
14. JDBC 4.0 Compliance
• Connection.java
– Gets proper createBlob() createClob() API’s
• Statement objects get a minor update
boolean isClosed() throws SQLException;
void setPoolable(boolean poolable) throws SQLException;
boolean isPoolable() throws SQLException;
• Blob API gets filled out a bit
free();
getBinaryStream(long pos, long length);
• Clob API gets filled out a bit
free();
getCharacterStream(long pos, long length);
14
15. PreparedStatement
• Added ability to use long data type in set* API’s
– Before you could only set up to a 2gb object due to
the use of int, now you can try to shove up to
Informix’s max limit blob/clob data
• Fixed a few areas around if you pass us a Reader
or InputStream as we could incorrectly try to
figure out how long it was. We should correctly
pull in data from the stream now
• Implemented more set* API’s around clobs,
character streams
• CallableStatment gets the same treatment
15
17. IfxSmartBlob
• A prerequisite for a number of JDBC 4.0
compliance implementations, we needed to be
able to write streamed data to a smart large
object.
• Added 6 new method calls to IfxSmartBlob.java
– These are helper methods for your existing Blob/Clob
API’s
– They allow streaming of any length of data from a
stream object in Java into a blob/clob (up to what
Informix supports or the size of a long which is huge)
public long write(int lofd, InputStream is) throws SQLException
public long write(int lofd, InputStream is, long length) throws SQLException
public long writeWithConversion(int lofd, InputStream is) throws SQLException
public long writeWithConversion(int lofd, InputStream is, long length) throws SQLException
public long writeWithConversion(int lofd, Reader r) throws SQLException
public long writeWithConversion(int lofd, Reader, long length) throws SQLException
17
18. IfxSmartBlob
• Created a default 32k buffer (matching the
internal 32K buffer size we use for sending
chunks of data through the network
– Adjustable with setWriteStreamBufferSize(int)
• Any codeset conversion that used to be done
via a write to a temp file is not done purely in
memory
– Much faster and we avoid creating files on disk to
do this work
18
19. DatabaseMetaData
19
java.sql.DatabaseMetaData.sqlStateSQL = 2 New State for DatabaseMetaData.getSQLStateType()
RowIdLifetime getRowIdLifetime() throws SQLException;
ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException;
boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException;
boolean autoCommitFailureClosesAllResultSets() throws SQLException;
ResultSet getClientInfoProperties() throws SQLException;
ResultSet getFunctions(String catalog, String schemaPattern,String functionNamePattern) throws
SQLException;
ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String
columnNamePattern) throws SQLException;
• Useful for middleware applications that work
with many drivers
– Example: Cognos
20. 4.10.JC8 Features
• JDBC Packaging
– Combined ifxjdbc.jar and ifxjdbcx.jar
– Removed the old ifxjdbcx.jar
• It was small, with extra overhead to build and test, and it’s features
complimented what was in ifxjdbc.jar already
– Removed SQLJ from the JDBC installer
• Not maintained, can still get it from older drivers or IBM JCC
• Simplifies and streamlines what we produce and what you see.
– Javadoc we produce no longer has the BSON API’s
• Javadocs and source for Bson available online already
• http://api.mongodb.com/java/2.2
• IfxDriver.connect() no longer requires a properties object
– Was annoying to have to code
Connection con = new IfxDriver(new Properties()).connect(….)
– Now can write
Connection con = new IfxDriver().connect(….)
20
21. JDBC and Maven
• Starting with 4.10.JC8W1
• JDBC drivers are published to maven central!!
• Prior work with Gradle builds makes this easier to
achieve.
• Most direct implementation of DevOps,
continuous delivery yet for Informix
• Versioning
– Maven artifacts prefer semantic versioning
– For JDBC we use 3 or 4 digits
• Latest JDBC driver 4.10.8.1
• Next JDBC driver likely is 4.10.9
21
22. JDBC and Maven
• Accessing the driver is easier than ever
• Bypasses hurdles with publishing through
prior mechanisms
http://mvnrepository.com/artifact/com.ibm.informi
x/jdbc/4.10.8.1
• Link takes you to Maven’s search page with
details about the driver and version
• You can directly download the jar from pages
like this
22
24. JDBC and Maven
• This allows you to easily and programmatically
grab the driver
• Using your own Gradle, Maven, SBT to pull in
latest versions of the driver
• Can even use ‘curl’ or wget to pull down the
file directly from the web
• Can stage drivers into your own internal
Maven repository
24