I am working a project that will require a custom “wizard” to help a non-technical user to install a custom database driven application. The main concern is to not set up a new database for the custom application if there is a suitable database engine already in place. So the question comes: how to programmatically detect the type and location of existing database engines?
The trick here is that the requirements for the installer are that the wizard assists a non technical user decide if a database engine exists on the local private network that is on the compatibility list. If so, assist the non technical user with forming a connection to the selected database engine. Otherwise the wizard is to install a database etc.
Would it be better to just install the preferred DBMS regardless of the existing database scene? The platform is a windows box, but platform independence is a goal of the project.
I don’t know if I am just using the wrong search terms or if there is little to no real information to this effect, but finding out if this is even possible has been frustrating.
Any help, advice, links, code resources, etc. will be greatly appreciated.
EDIT The goal of detecting the location and type of existing databases is to provide a simple list that a user can select from, for the case of adding an additional instance of the application on a private network for the current version or as an upgrade of the version (to effect a “clean” install). The application is a bit distributed in that there are typically going to be many instances of the application (3 – 10) working as terminals to interact with the database, manipulating the information in different ways for different uses on different terminals. The I think the preferred DBMS has settled on PostgreSQL.
- Steve
If you know what type of database you’re trying to connect to, you should be able to
pingthe default port for that type of database to see whether it returns a response. Or alternatively, try to open an actual connection to the database and see whether you get a response.Getting more complicated, if you can access the PC on the network, browse to the default installation directories for the database type to see if anything exists.
These 2 so far would require the database to be installed using default locations and ports.
Getting more complicated, if you can connect to the registry on the remove PC then you can probably locate the database in the registry tree – this is going to be fixed no matter where the user installs the database
My suggestion would probably be to completely avoid this though, as it adds a lot of complexity without much payback. If your application is for a non-technical end user, it’d probably be better to just assume that there isn’t any databases available to them, and just install a new one as part of the installer. Non-technical users are only going to be confused if you present them with a whole list of database options that really don’t mean anything to them.
It could also potentially take a long time to query your local network, depending on how many network shares exist, and how quick they are to respond. All this would take away from the responsiveness of the installer, so the end user might not know why the installer isn’t doing anything.
If you really want to give the option of choosing an existing database, I’d make it a separate optional button which would take them to another screen where they can choose a network host to investigate – the only people who would get to this screen would be more technical people who would probably know where a database exists anyway.