DB, Sessions, and Persistence with IntraWeb 12 in Delphi XE2

I am looking for information about connecting a database (Firebird in my case) with IntraWeb applications.

I especially need to know the difference (s) related to using the database in TDataModule with the LockDataModule function, or using the database at UserSessionUnit. For example, I want the database to shut down completely if no user is using the server and no more than 30 users will be connected.

In the worst case scenario, I can connect to some old Paradox database, and I need a structure that can handle this (I know that I will have to create a folder based on WebApplication.AppID to handle the sessions). At worst...

Thanks in advance for any information or useful links you could provide me ^^

+4
source share
2 answers

Scenario 1 - you leave the "Pool Data Connections" unchecked in the Intraweb Application Wizard

In this case, the wizard creates a ServerController , a UserSession , but not a DataModule . You host the database, session, and dataset components on a UserSession .

When a new user connects to your website, a new instance of UserSession is created and a connection to the database is created. When ServerController.SessionTimeOut expires due to user inactivity, the UserSession destroyed and this particular database connection is disconnected.

For 30 concurrent users, this model is likely to be okay for you and should ensure that all database connections are disconnected when the website is not in use.

Scenario 2 - you check "Pool Data Connections" in the Intraweb Application Wizard

Like ServerController and UserSession , the wizard will create an empty DataModule . You host database, session, and dataset components on a DataModule .

ServerModule has a TIWDataModulePool component on it that has the PoolCount property.

When the application starts, PoolCount creates PoolCount instances, each of which makes a connection to the database. Because your pages require access to the database, they call LockDataModule and UnlockDataModule to temporarily use one of the DataModule instances from the pool.

When the application closes, the DataModule instances in the pool are destroyed and their database connections are closed.

This model is suitable if having an open database connection for each user exceeds the capabilities of your database server. For 30 users connecting to the FireBird database, I do not think this will be required.

+5
source

You might want to consider using a set of components such as kbmMW, http://www.components4programmers.com/ I have used this for many years with desktop applications and now with IW Programs. I am deploying my applications as Services and currently have several issues deploying as ISAPI. kbmMW is well suited for an application with a lot of connections as it offers pooling, etc. It has many features and benefits. Check out the site for yourself.

I am using the Enterprise version, although I think the free version might be useful to you.

Hooray!

-Lou

0
source

Source: https://habr.com/ru/post/1390652/


All Articles