Mimer JDBC Drivers provide access to Mimer SQL databases from Java applications and applets. The drivers are type 4 drivers, which means that they are written entirely in Java. As they are written in Java, they can be downloaded in applets.
Mimer JDBC Drivers can also be used on all platforms that support Java Virtual Machine (JVM) and so provide a very high degree of portability.
About this Guide
The guide is intended for Java application developers working with Mimer SQL. It covers all available Mimer JDBC drivers.
The guide describes the usage of SQL in Java applications, and provides, together with the Mimer SQL Reference Manual, the complete reference material for Mimer SQL.
To read more about JDBC and JVM, visit http://www.oracle.com/technetwork/java/javase/tech/index-jsp-136101.html.
The JDBC API specification implemented by this driver (packages java.sql and javax.sql) is found at http://download.oracle.com/javase/1.4.2/docs/api/java/sql/package-summary.html and http://download.oracle.com/javase/1.4.2/docs/api/javax/sql/package-summary.html.
Definitions, Terms and Trademarks
Application Programming Interface Connected Limited Device Configuration Enterprise Java Beans Java Community Process The Java database API Java Development Kit Java Naming and Directory Interface Java Native Interface Java Runtime Environment Java Virtual Machine K Virtual Machine, a compact portable JVM, intended for small, resource constrained devices Mobile Interface Device Profile Optimistic Concurrency Control Persistent Stored Modules, the term used by ISO/ANSI for stored procedures Structured Query Language Uniform Resource Locator
All other trademarks are the property of their respective holders.
At the moment, the following Mimer JDBC drivers are available:
- mimjdbc3.jar supports the JDBC 3 specification and is J2EE compliant. This is currently the main JDBC driver, which should be used in most situations. This driver requires a Java 1.4 runtime or later.
- mimjdbc1.jar and mimjdbc2.jar supports the JDBC 1.2 and JDBC 2 specifications respectively. These drivers support the same server features as mimjdbc3.jar, but are supposed to be used on platforms and in environments where modern Java runtime environments are not supported. mimjdbc2.jar is J2EE compliant.
- midjdbc2.jar implements a subset of the functionality provided by the minjdbc3 driver. It is J2ME compliant and is supposed to be used in environments supporting the CLDC/Mobile Information Device Profile specification. See further down in this document for specifics on what is supported and not.
mimjdbc3.jar Mimer SQL 8.2 or later JRE 1.4 or later mimjdbc2.jar Mimer SQL 8.2 or later JRE 1.2 or later mimjdbc1.jar Mimer SQL 8.2 or later JRE 1.1.8 or later midjdbc2.jar Mimer SQL 8.2 or later J2ME CLDC 1.0.4/MID Profile 2.0 or CLDC 1.0/MID Profile 1.0 with extra support for the socket protocol within the Generic Connection Framework
Mimer JDBC has a complete range of functionality and support for the smallest devices to the high-end systems and application servers. In the picture below the various Java environments are described and coupled with computer environments and Mimer JDBC drivers:
In addition, the mimjdbc1 and mimjdbc2 drivers are available for older environments (see Available Drivers).
Differences Between the Drivers
In most cases the mimjdbc3 driver should be used. The mimjdbc1 and mimjdbc2 drivers should be used when only older Java runtime environments are supported. The minjdbc3 and midjdbc2 drivers are mainly for smaller and resource constrained environments.
The following table lists differences between the drivers:
Array Fetches Yes Yes Yes Yes Batch Operations No Yes Yes Yes CallableStatements Yes Yes Yes Yes DatabaseMetaData Support Yes Yes Yes Yes DataSource No Yes Yes Yes Distributed Transactions (XA) No Yes Yes No Driver identification support Yes Yes Yes No Driver-class Support Yes Yes Yes No Holdable cursors No No Yes No java.sql.Blob, java.sql.Clob No Yes Yes Yes JavaBean configuration No Yes Yes No May be stored in connection pools No Yes Yes No May be stored in JNDI No Yes Yes No National character Support Yes Yes Yes Yes Native SQL expansions Yes Yes Yes Yes Parameter metadata No No Yes No Scrollable ResultSets No Yes Yes Yes Set FetchSize No Yes Yes Yes SQL data types: BLOB, CLOB, and NCLOB Yes Yes Yes Yes Updatable result sets No No No No
Note: A requirement for functionality support regarding to the table above is that the database server version used is supporting the functionality.
The default fetch size for the mimjdbc drivers is about 64 kB. In the minjdbc and midjdbc drivers the buffer size is 10 kB. This buffer size can be manipulated using the .setFetchSize method.
About the JDBC Driver for Midlets (midjdbc3)
The Mimer MIDP driver should be used in environments supporting the CLDC/MID Profile specification. It is a strict subset of the regular JDBC for CDC configurations API. Also applications developed with Mimer MIDP will run with little change in a regular JDBC environment and vice versa. Programming skills obtained using regular JDBC programming may be applied to programming within the MIDP environment as well.
The following features are omitted in the Mimer JDBC for MIDP:
- All methods requiring floating point data types (such as ResultSet.getDouble). See below on floats, doubles and BigDecimal's for guidelines on handling these cases.
- All methods requiring a java.sql.Date, java.sql.Time and java.sql.Timestamp data type. When working with SQL date, time and timestamp data, please consider using ResultSet.getString, PreparedStatement.setString and other string getter and setter methods instead.
- The MIDP driver has no finalize() methods. This means that it is even more important for applications to explicitly close database objects when done with them.
- Since the java.math library is omitted from MIDP, no BigDecimal's may be used. Please consider using the appropriate java.lang.String getter or setter method.
- There is no java.sql interface. Programs interact directly against the com.mimer.jdbc classes instead. See below for a list of corresponding classes. Basically, instead of importing java.sql.*, you should import com.mimer.jdbc.* instead and carry on as usual.
Importing the JDBC Classes
Because the K Virtual Machine per default does not allow loading system class (java.*) applications accessing Mimer SQL databases should import the com.mimer.jdbc.* classes instead. This makes the application less portable than a regular JDBC application, but these are the constraints set by the environment.
The following Mimer classes correspond to the named interface classes in the regular JDBC API.
java.sql.BatchUpdateException com.mimer.jdbc.BatchUpdateException java.sql.Blob com.mimer.jdbc.Blob java.sql.CallableStatement com.mimer.jdbc.CallableStatement java.sql.Clob com.mimer.jdbc.Clob java.sql.Connection com.mimer.jdbc.Connection java.sql.DatabaseMetaData com.mimer.jdbc.DatabaseMetaData java.sql.DataSource com.mimer.jdbc.MimerDataSource java.sql.DataTruncation com.mimer.jdbc.DataTruncation java.sql.PreparedStatement com.mimer.jdbc.PreparedStatement java.sql.ResultSet com.mimer.jdbc.ResultSet java.sql.ResultSetMetaData com.mimer.jdbc.ResultSetMetaData java.sql.SQLException com.mimer.jdbc.SQLException java.sql.SQLWarning com.mimer.jdbc.SQLWarning java.sql.Statement com.mimer.jdbc.Statement java.sql.Types com.mimer.jdbc.Types
See also the javadoc for the Mimer MIDP driver. It is available on the Mimer SQL Developer site: http://developer.mimer.com/documentation/latest_javadoc_midp/index.html.
FLOAT and DOUBLE PRECISION
Databases with FLOAT, DOUBLE PRECISION, REAL and INTEGER(n) columns which are required to expose these numbers in a MIDlet can use one the following tricks to go around the float and BigDecimal limitation in the K Virtual Machine.
- It is always possible to get the SQL FLOAT or DOUBLE PRECISION value into a java.lang.String. This will work particularly well if the data is only to be displayed.
- To handle fractions so that they may be used to some calculations, make sure at the SQL level to always return integers and reserving the last digits of the integer for decimals. If the database has a FLOAT column and we are interested in 4 decimals, do the following SQL:select cast(OUR_FLOAT*10000 as bigint) from OUR_TABLE
- At the application level, place the result in an int or a long, but assume that the last 4 digits are decimals when displaying values to the user. In addition, decimals entered by the user must be handled similarly by the application before being inserted to the database. The following SQL statement may be used to make the float appear correctly in a table.insert into OUR_TAB(OUR_FLOAT) values (cast(? as float)/10000);
DATE, TIME and TIMESTAMP
DATE, TIME and TIMESTAMP system classes (java.util.Date) are not included in the MIDP specification. Therefore the Mimer client cannot return DATE, TIME or TIMESTAMP objects. Please use string getter and setter methods instead.
To keep the driver size small and to optimize performance the Mimer JDBC drivers do not perform any logging. For logging, we provide a separate driver, Mimer JDBC Trace driver.
Mimer JDBC Trace driver is a full JDBC Driver that covers all of JDBC by calling the matching routines of the logged JDBC Driver.
It produces a log of every JDBC call an application makes, and also measures the elapsed time for each call. The log can be written to a file, or can be displayed directly in a window.
For more information, see http://developer.mimer.com/howto/howto_28.htm.
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40