Connection problem to SQL Server Database from BIRT RE 3.7.1 [message #816005] |
Thu, 08 March 2012 09:55 |
Claude B Messages: 32 Registered: February 2012 |
Member |
|
|
Hi all,
I'm trying to run reports using BIRT Report Engine 3.7.1 and I want to generate its html output, here is my code:
package calcul;
import java.util.HashMap;
import java.util.logging.Level;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
public class Executer {
public static void main(String[] args) {
try {
Executer.executeReport();
} catch (EngineException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void executeReport() throws EngineException
{
IReportEngine engine=null;
EngineConfig config = null;
try{
config = new EngineConfig( );
//config.setBIRTHome("C:\\K\\ReportEngine");
config.setLogConfig("c:/temp/test", Level.FINEST);
Platform.startup( config );
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
engine = factory.createReportEngine( config );
IReportRunnable design = null;
//Open the report design
design = engine.openReportDesign("rapports/rapport1.rptdesign");
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
//task.setParameterValue("Top Count", (new Integer(5)));
//task.validateParameters();
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFileName("rapports/rapport1.html");
options.setOutputFormat("html");
//options.setHtmlRtLFlag(false);
//options.setEmbeddable(false);
//options.setImageDirectory("C:\\test\\images");
task.setRenderOption(options);
task.run();
task.close();
engine.destroy();
}catch( Exception ex){
ex.printStackTrace();
}
finally
{
Platform.shutdown( );
}
}
}
When I run a simple report using connection to the jdbc:classicmodels:sampledb database or to a local MySQL database (after importing the MySQL driver), I get no errors. But when I run a report using connection to an external SQL Server database, I get the following error:
Mar 8, 2012 10:45:57 AM com.microsoft.sqlserver.jdbc.SQLServerConnection <init>
SEVERE: Java Runtime Environment (JRE) version 1.6 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.
Mar 8, 2012 10:45:58 AM com.microsoft.sqlserver.jdbc.SQLServerConnection <init>
SEVERE: Java Runtime Environment (JRE) version 1.6 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.
I added the SQL Server driver (sqljdbc4.jar) to my libraries (exactly like the working MySQL driver), I even imported it as an external library but I'm always getting the same error.
The same report works perfectly using BIRT Designer 3.7.1
PS:
My JAVA version is 1.6.0.07
I'm using Eclipse BIRT 3.7.1
|
|
|
Re: Connection problem to SQL Server Database from BIRT RE 3.7.1 [message #816519 is a reply to message #816005] |
Thu, 08 March 2012 23:56 |
|
Do you have any other versions of the driver in your classpath? When
you are in the designer what jars show up in the Manage Jdbc Drivers dialog?
http://www.eclipse.org/forums/index.php/m/768875/
Jason
On 3/8/2012 4:55 AM, Claude B wrote:
> Hi all,
>
> I'm trying to run reports using BIRT Report Engine 3.7.1 and I want to
> generate its html output, here is my code:
>
> package calcul;
>
> import java.util.HashMap;
> import java.util.logging.Level;
>
> import org.eclipse.birt.core.framework.Platform;
> import org.eclipse.birt.report.engine.api.EngineConfig;
> import org.eclipse.birt.report.engine.api.EngineException;
> import org.eclipse.birt.report.engine.api.HTMLRenderOption;
> import org.eclipse.birt.report.engine.api.IReportEngine;
> import org.eclipse.birt.report.engine.api.IReportEngineFactory;
> import org.eclipse.birt.report.engine.api.IReportRunnable;
> import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
>
>
> public class Executer {
>
> public static void main(String[] args) {
> try {
> Executer.executeReport();
> } catch (EngineException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
> public static void executeReport() throws EngineException
> {
>
> IReportEngine engine=null;
> EngineConfig config = null;
>
> try{
> config = new EngineConfig( );
> //config.setBIRTHome("C:\\K\\ReportEngine");
> config.setLogConfig("c:/temp/test", Level.FINEST);
> Platform.startup( config );
> IReportEngineFactory factory = (IReportEngineFactory) Platform
> .createFactoryObject(
> IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
> engine = factory.createReportEngine( config );
>
> IReportRunnable design = null;
> //Open the report design
> design = engine.openReportDesign("rapports/rapport1.rptdesign");
> IRunAndRenderTask task = engine.createRunAndRenderTask(design);
> //task.setParameterValue("Top Count", (new Integer(5)));
> //task.validateParameters();
>
> HTMLRenderOption options = new HTMLRenderOption();
> options.setOutputFileName("rapports/rapport1.html");
> options.setOutputFormat("html");
> //options.setHtmlRtLFlag(false);
> //options.setEmbeddable(false);
> //options.setImageDirectory("C:\\test\\images");
>
> task.setRenderOption(options);
> task.run();
> task.close();
> engine.destroy();
> }catch( Exception ex){
> ex.printStackTrace();
> }
> finally
> {
> Platform.shutdown( );
> }
> }
>
> }
>
>
>
> When I run a simple report using connection to the
> jdbc:classicmodels:sampledb database or to a local MySQL database (after
> importing the MySQL driver), I get no errors. But when I run a report
> using connection to an external SQL Server database, I get the following
> error:
>
> Mar 8, 2012 10:45:57 AM com.microsoft.sqlserver.jdbc.SQLServerConnection
> <init>
> SEVERE: Java Runtime Environment (JRE) version 1.6 is not supported by
> this driver. Use the sqljdbc4.jar class library, which provides support
> for JDBC 4.0.
> Mar 8, 2012 10:45:58 AM com.microsoft.sqlserver.jdbc.SQLServerConnection
> <init>
> SEVERE: Java Runtime Environment (JRE) version 1.6 is not supported by
> this driver. Use the sqljdbc4.jar class library, which provides support
> for JDBC 4.0.
>
> I added the SQL Server driver (sqljdbc4.jar) to my libraries (exactly
> like the working MySQL driver), I even imported it as an external
> library but I'm always getting the same error.
> The same report works perfectly using BIRT Designer 3.7.1
>
> PS:
> My JAVA version is 1.6.0.07
> I'm using Eclipse BIRT 3.7.1
|
|
|
|
Powered by
FUDForum. Page generated in 0.03269 seconds