I’m creating a perl program where the user has to enter the name of a database, in addition to a username and password, and the program connects to that database using DBI->connect. What I’d like to do is to have the program present a list of names of databases that it can connect to, and all the user has to do is input their username and password, for ease of use. I took a look at the DBI documentation for data sources, thinking it was what I need but when I call DBI->data_sources('Oracle') it doesn’t return anything (but no errors are encountered either). I don’t see how this can happen, as the program is able to connect without any hitches if the user supplies the database name. Is there something that I’m doing wrong, or something that I’m not getting?
And yes, I realize I can just manually open the tnsnames.ora file and parse that. In fact, that’s what I did first but I’d like to use DBI preferably.
Try this: