I've an Apache Derby database running (in networked mode) in the java swing application, I connect with it through direct JDBC calls using a java client application.

This really is all excellent and is effective however know come with an additional requirement to implement concurrent licenses with this client/server application.

Ideally a person having a single user license should have the ability to have 1 client application running on the laptop in addition to a second client application running on the desktop and have the ability to connect with the server from both.

I not have the luxury of the web server and so i am wondering if my only option is by using the "maxthreads" runtime property in Derby and basically pressure the consumer to need to leave laptops say if they would like to then make use of the application using their desktop.

Basically leave the timeslice property to then will a phone call to getConnection timeout to ensure that I'm able to display a note towards the user explaining that they must disconnect among the client applications.

Are connection threads a trusted method of carrying this out?

Shall We Be Held missing another solution?

Thank you for any input.


Basically comprehend the question properly, you've user-locked licenses and wish to prevent just one user having a single license from being able to access the "server" from several demonstration of the customer at any given time. Your "server" is only a database and you won't want to create a credit card applicatoin layer around the server side.

I do not enjoy your initial suggestion of utilizing the thread pool and connection timeout to enforce certification constraints because each of individuals things can be used for other reasons.

Rather, to resolve i might consider needing the consumer to go in their license number in to the GUI the very first time they will use it. This is often held in anyone's home directory for subsequent begins from the GUI. Exactly the same happens when they start the GUI the very first time on another machine. Then, for every transaction the GUI makes using the database, it might first update a licenses table or much like indicate anyone's license is presently getting involved in a transaction. Wherever exactly the same license has already been within the table, marked as active, or similar, the GUI would reject the transaction and display towards the user their license has already been being used by another client.

If you want this concept, think it through farther than I've. I can tell some errors in logic securing customers out permanently :-)

It appears like you need to make the act of "signing in" and "logging out" from the database explicit, so possibly you might want to possess a special table within the database where the application creates an archive whenever you sign in or out.

Your application can query that table to discover if other copies from the application are presently drenched in.

You might like to include additional fields within the table to trace the date/time whenever you drenched in/out, the hostname and Ip from the client which carried out the login/logout, etc.