Board index » off-topic » Re: Multiple apps sharing TSQLConnection in separate app

Re: Multiple apps sharing TSQLConnection in separate app


2006-03-24 12:41:36 AM
off-topic15
Ed Blanchard wrote:
Quote
So, any suggestions on best approach? The "find ConnectMe or start if
not running" I can handle - I'm looking for guidance on how to best
use a shared TSQLConnection in a separate app.
Write a stateless DataSnap server. This is close to automatic, then.
--
Craig Stuntz [TeamB] ?Vertex Systems Corp. ?Columbus, OH
Delphi/InterBase Weblog : blogs.teamb.com/craigstuntz
How to ask questions the smart way:
www.catb.org/~esr/faqs/smart-questions.html
 
 

Re:Re: Multiple apps sharing TSQLConnection in separate app

Oh, do note that this will generally not change your DB licensing
requirements, though. I don't know why you want only one connection,
but if it's to save money on DB server licenses it won't help.
--
Craig Stuntz [TeamB] ?Vertex Systems Corp. ?Columbus, OH
Delphi/InterBase Weblog : blogs.teamb.com/craigstuntz
Borland newsgroup denizen Sergio González has a new CD of
Irish music out, and it's good: tinyurl.com/7hgfr
 

Re:Re: Multiple apps sharing TSQLConnection in separate app

I'd like to set up a situation whereby I have an application that is
essentially a datamodule with a TSQLConnection waiting to be linked to
TSQLDatasets from other running applications.
That is, have a hidden app (ConnectMe.exe) running but not connected to
SQL back-end.
I'd then have any number of independent applications that, when started,
would find ConnectMe.exe and assign their TSQLDataset.SQLConnection to
ConnectMe's SCN.
All of this will be running on single workstations (that is, each
workstation will have their own ConnectMe, App1, App2...).
The notion here is that ConnectMe will quietly disconnect automatically
from SQL after some pre-determined time, but stay live long enough to
allow the end-user to run app1, app2, app3 (or app(n) over and over)
without having to wait for connect/authentication every time. These are
reports run from third-party application (which maintains it's own SQL
connection in a Powerbuilder app) - the PB app will call my apps with
command line params - I'm trying to make it look like my apps are
"integrated" into the PB main app - tough to do when it takes a few
seconds just to connect... <g>
So, any suggestions on best approach? The "find ConnectMe or start if
not running" I can handle - I'm looking for guidance on how to best use
a shared TSQLConnection in a separate app.
TIA
Cheers,
EdB
 

{smallsort}

Re:Re: Multiple apps sharing TSQLConnection in separate app

In article <4422ddfb$ XXXX@XXXXX.COM >,
XXXX@XXXXX.COM says...
Quote
Oh, do note that this will generally not change your DB licensing
requirements, though. I don't know why you want only one connection,
but if it's to save money on DB server licenses it won't help.

Not licensing - performance. I write add-on code to an MRP/ERP software
package created in Powerbuilder using Sybase ASA as back-end.
I've a dozen or so D7Ent/Reportbuilder custom reports that I've built
into a single custom app (using one TSQLConnection) - which of course is
run separately from the PB App. Now the users would like to see each of
these reports integrated into the main PB app in the "right screens".
The PB app has form customizing such that I can add a button anywhere I
want to shell out and call an exe with command-line parameter (eg.
"PrintWorkOrder.exe 10000" ). The problem with this is that each time
one of my report apps will be called, there's a delay based on
establishing the connection.
I'm looking for a way to have an app run in the background to keep the
connection live, and just set the report app's TSQLDataset.SQLConnection
to the background TSQLConnection...
The DB server licensing is such that EACH workstation pays for one seat
for the PB app, and one seat for all my custom apps (eg 2 seats per
workstation). Not sure how that works but the vendor assures me that I'm
"in compliance".
Thanks.
EdB
 

Re:Re: Multiple apps sharing TSQLConnection in separate app

Ed Blanchard wrote:
Quote
As I understand this, in ConnectMe App I'd have TSQLConnection,
TSQLDataSet and TDataSetProvider.

In App1, App2, App(n) I'd have TCDSProvider and TCDS...
No "TCDSProvider" -- such a thing doesn't exist AFAIK -- just TCDS.
Quote
This won't work for me - I change the TSQLDataSet.commandtext at run
time based on user input (not just simple parameters - sometimes as
much as 50% of SQL is changed - different tables, unions added etc).

Am I missing something?
Yes, TCDS.CommandText and TDSP.Options.psAllowCommandText. :)
--
Craig Stuntz [TeamB] ?Vertex Systems Corp. ?Columbus, OH
Delphi/InterBase Weblog : blogs.teamb.com/craigstuntz
All the great TeamB service you've come to expect plus (New!)
Irish Tin Whistle tips: learningtowhistle.blogspot.com
 

Re:Re: Multiple apps sharing TSQLConnection in separate app

In article <4422ddd0$ XXXX@XXXXX.COM >,
XXXX@XXXXX.COM says...
Quote
Ed Blanchard wrote:

>So, any suggestions on best approach? The "find ConnectMe or start if
>not running" I can handle - I'm looking for guidance on how to best
>use a shared TSQLConnection in a separate app.

Write a stateless DataSnap server. This is close to automatic, then.

As I understand this, in ConnectMe App I'd have TSQLConnection,
TSQLDataSet and TDataSetProvider.
In App1, App2, App(n) I'd have TCDSProvider and TCDS...
This won't work for me - I change the TSQLDataSet.commandtext at run
time based on user input (not just simple parameters - sometimes as much
as 50% of SQL is changed - different tables, unions added etc).
Am I missing something?
What I'm afraid I'll have to do is a "plugin" system, where I distribute
a helper app and DLL for every new report. That is, have my ConnectMe
app running with live TSQLConnection. I'll then create a helperApp for
every report to be invoked from PowerBuilder with a cmd line param. This
helperApp will then call ConnectMe with "registering reportOne
param=xxxx". The ConnectMe app then calls the appropriate package/dll
report... <ugly>.
EdB
 

Re:Re: Multiple apps sharing TSQLConnection in separate app

In article < XXXX@XXXXX.COM >, XXXX@XXXXX.COM
says...
Quote
Ed Blanchard wrote:
>
>In App1, App2, App(n) I'd have TCDSProvider and TCDS...

No "TCDSProvider" -- such a thing doesn't exist AFAIK -- just TCDS.
<sigh>Problem with speed-reading - I saw a line indicating:
ClientDataset1.SetProvider(DatasetProvider1);
and a code snippet with:
procedure TCDSProvider.InitAppServer;
and somehow by the time I closed the browser and returned to newsreader
that came out as "ClientDatasetProvider.DataSetProvider"
I need a holiday.
Quote
>This won't work for me - I change the TSQLDataSet.commandtext at run
>time based on user input (not just simple parameters - sometimes as
>much as 50% of SQL is changed - different tables, unions added etc).
>
>Am I missing something?

Yes, TCDS.CommandText and TDSP.Options.psAllowCommandText. :)
Aha! I always wondered why a CDS had CommandText... <g>
Ok, one last question (ha!) before I go test this out: do I need as many
TSQLDataset and TDatasetProvider components as TCDS components? In other
words, will I have to update the TSQLConnection datamodule everytime I
add a new app with new CDS definitions?
What if more than one app accessing data concurrently (or multiple
instances of one app)?
Thanks again Craig.
(Time for me to hit the bookshelf again)
Cheers,
EdB
 

Re:Re: Multiple apps sharing TSQLConnection in separate app

Ed Blanchard wrote:
Quote
Ok, one last question (ha!) before I go test this out: do I need as
many TSQLDataset and TDatasetProvider components as TCDS components?
In other words, will I have to update the TSQLConnection datamodule
everytime I add a new app with new CDS definitions?
Usually yes, but you don't have to put everything on one DM. I have an
article about how to split things up here:
blogs.teamb.com/craigstuntz/articles/IBInAMultiTierWorld.aspx
Quote
What if more than one app accessing data concurrently (or multiple
instances of one app)?
In a stateless server that's little different than a single app.
--
Craig Stuntz [TeamB] ?Vertex Systems Corp. ?Columbus, OH
Delphi/InterBase Weblog : blogs.teamb.com/craigstuntz
Want to help make Delphi and InterBase better? Use QC!
qc.borland.com -- Vote for important issues
 

Re:Re: Multiple apps sharing TSQLConnection in separate app

In article <4423e95a$ XXXX@XXXXX.COM >,
XXXX@XXXXX.COM says...
Quote
Ed Blanchard wrote:

>Ok, one last question (ha!) before I go test this out: do I need as
>many TSQLDataset and TDatasetProvider components as TCDS components?
>In other words, will I have to update the TSQLConnection datamodule
>everytime I add a new app with new CDS definitions?

Usually yes, but you don't have to put everything on one DM. I have an
article about how to split things up here:

blogs.teamb.com/craigstuntz/articles/IBInAMultiTierWorld.aspx

Thanks - I'll check this out.
EdB