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

Advantage Databese Reconection problem

edited February 2008 in DADE
Hello RB

This is the situation:

I have an DELPHI 7 DLL IntraWeb application running on a IIS, I use Advatage
Databese Server and of course RB with GNostice components for PDF

My application load the reports from a RTM file, generate a PDF then send it
the user. This work fine almost every time, except when for example when DB
server crash and restart.

When DB server succefully restarted, users are able to login again to the
ADS Dictionary but if they want to print some report, the report is not able
to connect, the explorer did not respond and finally shows a 'page not
found' error. (explorer timeout).

As far I can get into RB code, I assume there is a Tlist object with
ADSConnection objects, so when the report is being loaded it try to find the
connection on this list, but this is not the same instance of the
usersession, instead is the instance that have a broken connection due of
the DBServer crash.

How to recreate this is very simple.

an intraweb application that login to a ADS Server, load a report,
disconnect that session using ARC32, open a new explorer within intraweb
(without close the application), you where able to login, but the report
doesn't shows.

know my english is quite bad, i hope you understand my problem.

if there is no precedent of this situation and no help I can take time to
make a mini application for recreate this problem.

Regards

Comments

  • edited February 2008
    An example of ReportBuilder with Advantage is installed to
    RBuilder\Demos\EndUser Databases\Advantage.

    As shown in the example, we recommend placing an AdsConnection component on
    the same form/datamodule that contains the Report, Designer, ReportExplorer
    components.

    For report server and web applications you need a thread safe environment
    for the report. Typically this is provided by using a separate
    form/datamodule for each session. This is how we manage things in RB Server
    Edition and it works quite well. I do not know how your IntraWeb application
    is handling sessions or form/datamodule instances.

    If the database server crashes and restarts, then new sessions that create
    new form/datamodule instances should not be an issue. For existing
    sessions/instances the question is how does the AdsConnection component
    handle that type of situation? Is it able to reconnect? Or do you have to
    destroy it and create another instance? Or does it lock up or what?




    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2008
    Dear Nard,

    Everything you say is true, I forgot to mention. Each usersession have it's
    own Data module (DM is created at runtime for each session). This
    Datamodule have it's own ADSConnection, Tables and just one Report object.
    Usersession is where are the functions that read RTM files into the report.
    So my enviroment is quite Thread Safe for sure.

    I try remote report form DM in design time and create a fresh one every time
    a report is needed, make the PDF document then destroy it, but have nothing
    fixed.



    When DB server restart, every new session have no problem to connect to
    Advantage, ( the ADSConnection component I have in the Datamod of that fresh
    usersession) is like nothing happend for the user, but if that session what
    to print a report they get just nothing..... is like explorer is waiting for
    the page for a long time, then as I said, a 'page not found' is show.
    there's no error at the application, no hang, thay can still browse the
    application, run querys, show form, submit modification, everithing works
    except reports.

    procedure TdaADSSession.GetDatabaseNames(aList: TStrings);
    begin

    {call inherited to build list of available TADSConnection components}
    inherited GetDatabaseNames(aList);

    If I'm not wrong, aList is where are stored application ADSconnection right
    ? So when report is being generate look up that list and if matching name
    found then use that connection? well, I suspect this is causing my problem.

    How can I refresh this list ?

    If you want I can try to build a small example application and send with
    source code.

    Thank you very much.



  • edited February 2008

    TdaADSSession.GetDatabaseNames should result in the AdsConnection object
    that resides on the same DataModule as the Report being found. If this works
    prior to the database crash, then it should work afterwards.

    Try adding RBuilder\Source to your Delphi library path and then trace that
    method in the debugger. It will call the ancestor
    TdaSession.GetDatabaseNames which will then call some helper routines.


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2008
    Did you try debugging it - to see what happens in that code?

    You can send an example in .zip format to support@digital-metaphors.com. Any
    example needs to be a small focused project. Please do no use IntraWeb or
    any type of web app.



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2008
    Dear Nard,

    I begin again from scratch. No lucky. Now I have a small recreation of
    this situation. If you would kindly take a look maybe you can help me.
    Can I send the project to any email ?

    thank you in advance.


  • edited February 2008
    Dear Nard,

    I send you the zip with a very small example. Please let me know if you
    receive it and if you can take a look.
    Maybe with a simple function call it can be solved, but you know RB inside
    much better than me.

    Thank you.

  • edited February 2008
    Have not received anything - I checked the input box and junk mail folders.

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2008
    It's rare. will try attach here.

    As you told me, here is a small application that recreates the problem I
    have.

    What you have to do is follow whis steps.

    1 Build Application (sure..)
    2 Run it. A form 1 windows will appear with a 'new session' button
    3 Click 'new session'
    4 A second windows will show up, with name 'Instance 1'
    5 click print. A report will show up. Everything works as expected so far.
    6 Use Arc32 and in the 'Advanta Management Utility' go to 'Connected Users'
    tab
    7 find the appropiate line that is connected to TEST.ADD and TAB070.dbf
    file.
    8 right click and select ' Disconnect user....'
    9 back fot Form1 window and click 'new session'
    10 this will create a new windows 'Instance 2'
    As you can see on this form. you are connected again, data is show in the
    DBgrid.
    11 click print
    ......
    .....
    wait a while.... And you will get a 6316 error.

    Every 'Instance n' windows create it's own Datamod, connect ADSConnection
    object and have the report.

    If you have a work around for this situation I'm pretty sure I can solve the
    problem in my Intraweb application.

    Be waiting yor comments.

    Regards.


  • edited February 2008
    Please do post attachments to the newsgroups. See the tech support section
    of our web site for newsgroup guidelines.

    Your email has been received at support@


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2008
    Nard,

    I keep trying, and I'm almost close to success.

    I see ExtractSQLObject example, I apply again to my project. It works only
    with reports that have just one TdsSQL

    like/.... object daSQL1: TdaSQL
    CollationType = ctASCII
    DatabaseName = 'AdsConnection'


    but in reports like I have......

    object daSQL1: TdaSQL
    CollationType = ctASCII
    DatabaseName = 'AdsConnection'
    DatabaseType = dtAdvantage
    DataPipelineName = 'Resumenes_de_Cuenta'
    IsCaseSensitive = True
    .
    .
    object daSQL2: TdaSQL
    CollationType = ctASCII
    DatabaseName = 'AdsConnection'
    DatabaseType = dtAdvantage
    DataPipelineName = 'Detalle_de_Resumenes'
    IsCaseSensitive = True

    object daSQL3: TdaSQL
    CollationType = ctASCII
    DatabaseName = 'AdsConnection'
    DatabaseType = dtAdvantage
    DataPipelineName = 'Tab080'
    IsCaseSensitive = True


    How do I make to change DatabasName for daSQL2 and 3 using the
    GetSQLObject(aReport: TppReport; var aSQL: TdaSQL): Boolean; example
    function ?

    regards




  • edited February 2008



    uses
    daDataModule;

    lDataModule := daGetDataModule(aReport);

    then iterate over lDataModule.DataViews[ ] array from 0 to
    lDataModule.Count-1

    then typecast each DataViews[ ] item as TdaQueryDataView.

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

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