Home All Groups Group Topic Archive Search About
Author
27 Dec 2006 12:03 AM
Terry Olsen
I'm building a database export program where I want to allow the user to
choose a connection type (ODBC,OLEDB, or SQL), enter a connection
string, and then export the schema and a number of rows of data.

I need to fill a listbox with database names which the user id has read
access.

How would I go about getting the list of databases from a database
server such as SQL, Pervasive, Oracle, etc?  Is there a generic method
that works regardless of database provider?



*** Sent via Developersdex http://www.developersdex.com ***

Author
27 Dec 2006 2:53 AM
Spam Catcher
Terry Olsen <tolse***@hotmail.com> wrote in news:u80xCqUKHHA.1280
@TK2MSFTNGP04.phx.gbl:

>  Is there a generic method
> that works regardless of database provider?
>

I don't think so ... you'll have to query each database type manually.
Author
27 Dec 2006 5:29 PM
Mythran
Show quote Hide quote
"Terry Olsen" <tolse***@hotmail.com> wrote in message
news:u80xCqUKHHA.1280@TK2MSFTNGP04.phx.gbl...
> I'm building a database export program where I want to allow the user to
> choose a connection type (ODBC,OLEDB, or SQL), enter a connection
> string, and then export the schema and a number of rows of data.
>
> I need to fill a listbox with database names which the user id has read
> access.
>
> How would I go about getting the list of databases from a database
> server such as SQL, Pervasive, Oracle, etc?  Is there a generic method
> that works regardless of database provider?
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***

I wrote a database definition program awhile back that lists databases from
a server, then lists tables/column info and allows printing of the database
structure(s).  What I did was created an interface (IDatabaseInfo for
example) and had methods called GetDatabases, GetTables, GetColumns, etc.
Then, for each DBMS it supported, all we had to do was create a class that
implemented the interface (SqlDatabaseInfo, AccessDatabaseInfo).  Makes
things easier...and all you have to do is pass the class instance as the
interface around and call those methods :)

HTH,
Mythran