Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Display Database/Datasource Name/Connection Info Post Reply Post New Topic
Author Message
Chronicide
Newbie
Newbie


Joined: 19 Jul 2011
Online Status: Offline
Posts: 10
Quote Chronicide Replybullet Topic: Display Database/Datasource Name/Connection Info
    Posted: 19 Jul 2011 at 6:28am
Hello everyone,
 
I'm using Crystal Reports 2008, and I've come across a situation that requires that I display the connection info on the report itself.
 
I've done a lot of reading, and I think that it's impossible, but I figured that it couldn't hurt to ask.
 
The source of the data for the reports are a number of old Firebird databases. Each database has the same schema, so we are able to build the report once, then just run it against each database individually by changing the data source one by one. The problem is that it's imparative that we know which database the information for a given report came from.
 
Two solutions that I've found online to similar issues are:
 
- Use an SQL Expression Field to return {fn database()}
- Use an SQL Expression Field with something like "Select DB_NAME()"
 
The first solution fails with an error from the ODBC Firebird driver for an invalid token.
 
The second one isn't possible, as the database name isn't stored in any Firebird System Table, and there is no SQL code that will be able return the database name.
 
Currently, I've added a parameter field that requests the user to type in the name of the connected database, but this really pains me to do; it's prone to human error, data inconsistancies, and it's an extra step added to a number of reports that ares going to be ran several times every day.
 
Is there any way to display the connection string, Datasource Name, etc. without having the user enter it manually? I would really appreciate any possible solutions, as this is going to continue to be a major part of our daily activities...
 
Thanks for any help that you might be able to offer...
 
- Scott
 
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 19 Jul 2011 at 12:17pm
Copy the report for however many Databases you connect to with a slightly different name each time (I suggest adding the initials of the Database you are connecting to) and place the Database name in either the Report header or Page Header that it connects to and when you print the report it will automatically have the name with the report and you won't have to bother with changing the source either.
IP IP Logged
Chronicide
Newbie
Newbie


Joined: 19 Jul 2011
Online Status: Offline
Posts: 10
Quote Chronicide Replybullet Posted: 21 Jul 2011 at 5:00am

While a potentially sound solution for a small project, it isn't very viable for the current requirements. We have 43 historical databases, and 16 distinct reports to run against them. If this was something where each report had to be ran against each database daily, then I might consider it... but the reports are ran only in response to inquiries made. We will be running a fair amount of reports daily, but not all of them.

Aside from that, making 688 reports would cause a maintenance nightmare. I know that I didn't include this info in the original post, so I'm not saying this as criticism, just providing the additional information in order to explain why I can’t go with your suggestion. All the same, thanks for taking the time to reply.

 

I’m still banging my head against a brick wall with regards to this issue. I would still really appreciate any other potential solutions. Thanks again to CircleD for replying.

 

-       Scott

IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 21 Jul 2011 at 5:53am
could you create a temp table that stores the db names then you can join it and use that field.
sharona
IP IP Logged
Chronicide
Newbie
Newbie


Joined: 19 Jul 2011
Online Status: Offline
Posts: 10
Quote Chronicide Replybullet Posted: 21 Jul 2011 at 6:17am

Sure, I can create a temporary table, I could even just add a command with:

SELECT 'StringDatabaseName' AS DB_NAME FROM PERSON
 
But, unless I'm missing something (which is very possible) wouldn't I have to hard-code the name of the database into multiple copies of the same report, one for each database with the hard-coded name in it? That would pose the same issues as just chaning the text in the header, wouldn't it? Or is there something that I've missed?
 
If I misread, and you meant, 'could I alter the schema of the historic databases to add a table that would store the db name'? The answer to that is, unfortunately, no. I've been granted read-only access, and past requests for further permissions have been denied.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.