Skip to content

A java package that will return a jdbc connector given a database name, or a driver name and some parameters. Currently, knows about 55 connectors.

Notifications You must be signed in to change notification settings

edwardcrichton/dbdrivers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

dbdrivers

A java package that will return a jdbc connector given a database name, or a driver name and some parameters. Currently, knows about 55 connectors. Please do add more to the file jdbcdrivers.txt .

Example

Connecting to a database.


java.sql.Connection connection=null;

try
{
        dbdrivers.DBDrivers dbc=new dbdrivers.DBDrivers();
 
        Properties properties=new Properties();
        properties.put("database",databaseName);
        properties.put("user",databaseUser);
        properties.put("password",databasePassword);
        properties.put("host",databaseHost);

        // databaseType is either the name of a jdbc driver class
        // or name of the driver
        connection=dbc.getConnection(databaseType, properties);
}
catch(Exception ex)
{
         ...
}

...

Listing the names of the drivers.


dbdrivers.DBDrivers dbc=new dbdrivers.DBDrivers();
String[] driverNames=dbc.getAvailableDriverNames();

Listing all drivers, their names, classes, statuses and versions


dbdrivers.DBDrivers dbc=new dbdrivers.DBDrivers();
ArrayList drivers=dbc.getDriverList();

for(int i=0;i<drivers.size();i++)
{
  Object[] driverInfo=(Object[]) drivers.get(i);
  System.out.println(driverInfo[DBDrivers.DRIVER_TITLE]+" "+driverInfo[DBDrivers.DRIVER_CLASS]+" "+driverInfo[DBDrivers.DRIVER_STATUS]+" "+driverInfo[DBDrivers.DRIVER_VERSION]);
}

About

A java package that will return a jdbc connector given a database name, or a driver name and some parameters. Currently, knows about 55 connectors.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages