Home Server
New Blog Posts: Merging Reports - Part 1 and Part 2

Dynamically Set Database Alias

edited June 2003 in Server
I am in the process of deploying the first instance of my Report Server
application. Right now, I have a datamodule with the following components:

Session
Database
ReportTemplateVolume

The FileDirectory for the ReportTemplateVolume is being set dynamically at
startup from a configuration file.

I would like to set the Database Alias, UserName, and Password at startup
as well. I have tried placing logic in various events (datamodule create,
for example). In a debugger, I can see that this code is being processed,
but I always end up with a report server that is running with the values
that are hard-coded in the IDE.

Having an application with a hard-coded alias is slightly painful, a hard-
coded UserName and Password extremely painful.

Am I missing something easy here? Is there a way to do this?

--
Bob McClintock

Comments

  • edited June 2003

    1. Make sure that the Database.Connected property is set to False, prior to
    setting the DatabaseName, UserName, and Password.

    2. The file based reports that you created should reference a data
    connection component (i.e. TDabase for BDE, TADOConnection for ADO, etc).
    The reports should not directly contain the alias info. When the report
    loads it should then find the Database component and use the parameters.

    3. Be aware that the DataModules get created frequently - to build directory
    info and to get report parameters and to run reports.



    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.