Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trouble with ODBC CSV connection when export Crystal RPT to PDF

 
Marius Coetzee
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've posted the same question at "SAP Community Network" for if my problem is on the Crystal Report side. (here)
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2602
13
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you set up the ODBC as a System datasource in windows?
 
Jan Cumps
Bartender
Posts: 2602
13
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic