• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Trouble with ODBC CSV connection when export Crystal RPT to PDF

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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):

 
Bartender
Posts: 2662
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you set up the ODBC as a System datasource in windows?
 
Jan Cumps
Bartender
Posts: 2662
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).

 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic