.:Tutorial Three
 Home
 Screenshots
 Docs
 Download
 Project page
Tutorial Three: How to use a database like MS Access via ODBC bridge with iReport 0.0.6
Please note that form iReport 0.0.8 this "trick" is no more useful and all JDBC access are maded using pure java.

In this tutorial we will see how to configure iReports for use a ODBC driver.
Microsoft JVM is not compatible with java.sun.jdbc.odbcBridge class (One of the many debatable defects of the Microsoft java implementation). For this reason, the use of a ODBC driver is a bit complex in iReport. As we will see, the adopted solution will be the creation of two database connections, one Microsoft compatible and one Java "Sun" compatible. We will use the first inside of iReport, the second out iReport ( for compilation and preview).

Step1: creation of connections
1) Create an ODBC connection (i.e. an Microsoft Access System Data Source Name named "TEST_iReport")
2) Open iReport and select database->connections menu
4) Create two connection with follow parameters...

First connection (For use with Microsoft JVM):
Name = MS ODBC TEST
JDBC driver = com.ms.jdbc.odbc.JdbcOdbcDriver
JDBC URL = jdbc:odbc:TEST_iReport
USER = administrator

Second connection (For use with Sun JVM):
Name = SUN ODBC TEST
JDBC driver = sun.jdbc.odbc.JdbcOdbcDriver
JDBC URL = jdbc:odbc:TEST_iReport
USER = administrator





Step2: create the report (using iReport wizard)
1) Select File->Report wizard menu
2) Select MS ODBC TEST connection and write a select query for a table in the database
3) Click next and select preferred fields
4) Click next at step 3 of the wizard
5) Select a tabular report, i.e. the classic template and press 'next' button
6) Press the next button for finish report wizard. We have now a report for the selected table
7) Save the report




Step3: it's time to compiling
1) Select Tools->IReportCompiler menu
2) Check the XML file name
3) elect SUN ODBC TEST connection
3) Press the "compile" button
4) If all work correctly, without error, you have successfully compiled your report using an ODBC database connection




Return to docs


(c) 2002 by Giulio Toffoli <gt78 at businesslogic.it>