wood burning stoves 2.0*
The moose likes JDBC and the fly likes Trouble with ODBC CSV connection when export Crystal RPT to PDF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Trouble with ODBC CSV connection when export Crystal RPT to PDF" Watch "Trouble with ODBC CSV connection when export Crystal RPT to PDF" New topic
Author

Trouble with ODBC CSV connection when export Crystal RPT to PDF

Marius Coetzee
Greenhorn

Joined: Dec 02, 2011
Posts: 5
Good day all,

I'm trying to write a library that will convert/export a crystal RPT report to PDF, but is having problems accessing the data.

Background
In our case there is no database to access, the system simply produces a CSV where the RPT must extract its data from.
This is done by using "Microsoft Access Text Driver" ODBC pointing to the "Current Directory".
(When exporting a RPT to PDF with no data access data it works fine.)

Environment
Microsoft Windows Server 2008 64bit.
The environment the system run in can consume java libraries, thus our interest in using java (despite my obvious unfamiliarity with java beyond the simple if and for statements).

Problem
Running the below code I get "Error finding JNDI name (CSV_DSN)". I understand that it is failing to find connection to CSV_DSN and thus will try to use JNDI.
I then try to set up a JNDI connection using the CRJavaHelper but then get "com.businessobjects.reports.datamodel.DFException: The database connector cannot be changed when the connection is open."

(I've tried setting up a JDBC ODBC (bridge?) then referencing it with JNDI - hoping it will solve the problem, but after spending 2 days reading up on JNDI I did not manage to accomplish this. Most samples being for hosted environments).

Request / Plea
Please help me in getting the below to work.
An explanation on why it is going wrong, maybe a pointer in the right direction would also be much appreciated.

Thank you in advance,
Marius

Marius Coetzee
Greenhorn

Joined: Dec 02, 2011
Posts: 5
I've posted the same question at "SAP Community Network" for if my problem is on the Crystal Report side. (here)
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4343
    
    8

(I'm not sure which is the best forum for this, but it's certainly too complex for Beginning Java! So moving it here.)
Marius Coetzee
Greenhorn

Joined: Dec 02, 2011
Posts: 5
Thank you Matthew - I didn't know under which category to put it. The problem made me feel like I'm "Beginning Java"
Marius Coetzee
Greenhorn

Joined: Dec 02, 2011
Posts: 5
I now tried to retrieve the data and assign it to the table, but get an AssertionError when trying to assign the ResultSet to the report (c'mon! give me a break):

Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

Did you set up the ODBC as a System datasource in windows?


OCUP UML fundamental and ITIL foundation
youtube channel
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

Marius Coetzee wrote:I now tried to retrieve the data and assign it to the table, but get an AssertionError when trying to assign the ResultSet to the report...

What does that AssertionError say?
Marius Coetzee
Greenhorn

Joined: Dec 02, 2011
Posts: 5
Thank you Jan for replying.

It looks like I got it to work with the (non refactored) code below.

The AssertionError did not give me additional information, which I also thought was funny. But I did figure out it only did it when I was using JUnit to test it (not blaming JUnit, I'm almost 100% sure it was something I did).

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trouble with ODBC CSV connection when export Crystal RPT to PDF
 
Similar Threads
Configure Tomcat with Crystal Report
Crystal Reports XI R2 Chinese Display on PDF export
java and crystal report
error when trying to open crystal report
[Crystal Reports] JRCAgent1 received a request that cannot be handled by the JRC