The Java Database Connectivity (JDBC) API provides universal data access from the Java programming language. Using the JDBC 3.0 API, you can access virtually any data source, from relational databases to spreadsheets and flat files. JDBC technology also provides a common base on which tools and alternate interfaces can be built.
With the following script in a Stages dataset you can access the Stages mysql database on your local PC running Stages.
Class.forName("org.gjt.mm.mysql.Driver"); var url = "jdbc:mysql://localhost/pkit" con = DriverManager.getConnection( url, "root", "pass" ); stmt = con.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); srs = stmt.executeQuery("SELECT artifact_id FROM artifact"); while (srs.next()) { dataset.setColumnValue("id",srs.getInt("artifact_id")); dataset.storeResultRow(); } srs.close(); stmt.close(); con.close();
The JDBC driver must be in the Stages classpath in
[install directory]\projectkit\tomcat\webapps\pkit\WEBINF\ platform\plugins \org.eclipse.birt.report.data.oda.jdbc_x.y.z\drivers