Creating server connection on the fly

Hi all,

Does anyone knows if it’s possible to create a database connection live using javascript code, then use the switchServer() function to connect to this new database without having to reboot servoy server?

I’m planning a SaaS app. that will ultimatly connect to many different database.

Having to create this connection by hand will increase deploy time and cost.
Also having to restart servoy server to access a new connection makes it almost impossible to create a database when a new customer subscribe, since it would need a server restart and that would flush all active connection by other client on other databases as well…

Thanks

Philippe

good point!

I don’t think it is possible right now…

I would welcome that feature too!

motorup:
Does anyone knows if it’s possible to create a database connection live using javascript code, then use the switchServer() function to connect to this new database without having to reboot servoy server?

This is possible though you need the help of a Java plugin and some undocumented APIs to make it work. We had a similar requirement for our project and were able to do this with the help of a Servoy engineer. If you want further details let me know or you may want to contact Servoy directly…

I do believe this is functionality that should be readily accessible via Javascript though (maybe Tano delivers a solution for this?). I know Servoy presents table filters as their solution for multi-tenant applications but this is trivially bypassed via raw SQL queries so isn’t sufficient for situations where more robust security is required.

Regards,
Corey

Could you explain how you did it?

Thanks

Philippe

Hi Philippe,

if there’s no real need to connect to an unknown server, but just that you want to be able to create tables/cols: you might want to take a look at the ‘maintenance’ plugin which is shipped by default in Servoy 5.

I’ll explain a little bit what I’m currently building, you 'll understand why I’m asking for connection on the fly.

I’m building a SAS Product CMS design to hold many thousands of products data for a lot of customer. I can’t use a single DB to hold all this data. Even if mysql can hold that much information imagine if there was a glitch and some data were erased by mistake… I could not justify to my customer why the action of a third customer just delete one (or many) of he’s products…

Also since customers will use the system on my server, If I want to add a new customer (and it’s DB) I need to add a connection to servoy’s connection list and restart the server… which will disconnect everyone…

Anyway thanks all for your time

Regards

Philippe Beaulieu

motorup:
Even if mysql could hold that much information imagine

That must be a lot of information!

motorup:
I could not justify to my customer why the action of a third customer just delete one (or many) of he’s products…

if you’d use tablefilters, Servoy can filter on ‘customer id’ so there won’t be a chance 1 customer deleting records of another.

We do have a SAAS environment as well, but with only 1 DB!

mboegem:

motorup:
Even if mysql could hold that much information imagine

That must be a lot of information!

I love usefull comments… But for the records, some of our customers tables holds a few millions records… Multiply that by many customers and you’ve got a receipes for problems.

mboegem:

motorup:
I could not justify to my customer why the action of a third customer just delete one (or many) of he’s products…

if you’d use tablefilters, Servoy can filter on ‘customer id’ so there won’t be a chance 1 customer deleting records of another.

We do have a SAAS environment as well, but with only 1 DB!

I’m happy for you. But again I don’t think that you should justify the data integrity of all your customer’s to a simple “filter”. I know that theoricaly it’s workable. I just know it’s unsafe. Even if servoy can filter data by cystomer, there’s always manual maintenance to do on databases and with many customers in one pot, errors will cost a lot more.

I thought that one of Marcels plugins boasted allowing to make a connection on the fly, but this may only be for raw sql stuff, rather than making that connection available to the whole solution model.

David