Servertec
Foundation Classes
1.3.3 09/04/2005

stec.sfc.Win32
Class OdbcManager

java.lang.Object
  extended by stec.sfc.Win32.OdbcManager

public final class OdbcManager
extends java.lang.Object

Used to add, remove and enumerate ODBC Data Sources and to enumerate ODBC drivers.

Since:
1.3.0 10/19/2003

Constructor Summary
OdbcManager()
           
 
Method Summary
static void addFileDataSource(java.lang.String name, java.util.Hashtable attributes)
          Adds a File Data Source.
static void addSystemDataSource(java.lang.String name, java.lang.String driver, java.util.Hashtable attributes)
          Adds a System Data Source.
static void addUserDataSource(java.lang.String name, java.lang.String driver, java.util.Hashtable attributes)
          Adds a User Data Source.
static boolean existsFileDataSource(java.lang.String name)
          Returns whether the named File Data Source exists.
static java.util.Enumeration getDrivers()
          Returns an Enumeration of any ODBC Drivers.
static java.lang.String getFileDataSourceDirectory()
          Returns the path to the directory where file data sources are stored.
static java.util.Enumeration getFileDataSources()
          Returns an Enumeration of any File Data Sources.
static java.util.Enumeration getSystemDataSources()
          Returns an Enumeration of any System Data Sources.
static java.util.Enumeration getUserDataSources()
          Returns an Enumeration of any User Data Sources.
static boolean removeFileDataSource(java.lang.String name)
          Removes the named File Data Source.
static void removeSystemDataSource(java.lang.String name, java.lang.String driver)
          Removes the named System Data Source.
static void removeUserDataSource(java.lang.String name, java.lang.String driver)
          Removes the named User Data Source.
static void setFileDataSourceDirectory(java.lang.String path)
          Used to specify the directory where file data sources are stored.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OdbcManager

public OdbcManager()
Method Detail

getFileDataSourceDirectory

public static final java.lang.String getFileDataSourceDirectory()
Returns the path to the directory where file data sources are stored.

Returns:
the path to the directory where file data sources are stored. Normally C:\Program Files\Common Files\ODBC\Data Sources\.

setFileDataSourceDirectory

public static final void setFileDataSourceDirectory(java.lang.String path)
                                             throws java.lang.IllegalArgumentException
Used to specify the directory where file data sources are stored.

Parameters:
path - the path to the directory where file data sources are stored.
Throws:
java.lang.IllegalArgumentException

addUserDataSource

public static final void addUserDataSource(java.lang.String name,
                                           java.lang.String driver,
                                           java.util.Hashtable attributes)
                                    throws Win32Exception,
                                           java.io.IOException
Adds a User Data Source.

Parameters:
name - the name of the Data Source.
driver - the name of the ODBC driver.
attributes - any attributes.
Throws:
java.io.IOException - if an IO exception occurs while adding the Data Source.
Win32Exception - if any exception occurs while adding the Data Source.

addSystemDataSource

public static final void addSystemDataSource(java.lang.String name,
                                             java.lang.String driver,
                                             java.util.Hashtable attributes)
                                      throws Win32Exception,
                                             java.io.IOException
Adds a System Data Source.

Parameters:
name - the name of the Data Source.
driver - the name of the ODBC driver.
attributes - any attributes.
Throws:
java.io.IOException - if an IO exception occurs while adding the Data Source.
Win32Exception - if any exception occurs while adding the Data Source.

addFileDataSource

public static final void addFileDataSource(java.lang.String name,
                                           java.util.Hashtable attributes)
                                    throws Win32Exception,
                                           java.io.FileNotFoundException,
                                           java.io.IOException
Adds a File Data Source.

Parameters:
name - the name of the Data Source.
attributes - any attributes.
Throws:
java.io.IOException - if an IO exception occurs while adding the Data Source.
Win32Exception - if any exception occurs while adding the Data Source.
java.io.FileNotFoundException

removeUserDataSource

public static final void removeUserDataSource(java.lang.String name,
                                              java.lang.String driver)
                                       throws Win32Exception,
                                              java.io.IOException
Removes the named User Data Source.

Parameters:
name - the name of the Data Source.
driver - the name of the ODBC driver.
Throws:
java.io.IOException - if an IO exception occurs while removing the Data Source.
Win32Exception - if any exception occurs while removing the Data Source.

removeSystemDataSource

public static final void removeSystemDataSource(java.lang.String name,
                                                java.lang.String driver)
                                         throws Win32Exception,
                                                java.io.IOException
Removes the named System Data Source.

Parameters:
name - the name of the Data Source.
driver - the name of the ODBC driver.
Throws:
java.io.IOException - if an IO exception occurs while removing the Data Source.
Win32Exception - if any exception occurs while removing the Data Source.

removeFileDataSource

public static final boolean removeFileDataSource(java.lang.String name)
Removes the named File Data Source.

Parameters:
name - the name of the Data Source.
Returns:
whether the File Data Source was deleted.

existsFileDataSource

public static final boolean existsFileDataSource(java.lang.String name)
Returns whether the named File Data Source exists.

Parameters:
name - the name of the Data Source.
Returns:
whether the named File Data Source exists.

getUserDataSources

public static final java.util.Enumeration getUserDataSources()
                                                      throws Win32Exception
Returns an Enumeration of any User Data Sources.

Returns:
the Enumeration of any User Data Sources.
Throws:
Win32Exception - if any exception occurs.

getSystemDataSources

public static final java.util.Enumeration getSystemDataSources()
                                                        throws Win32Exception
Returns an Enumeration of any System Data Sources.

Returns:
the Enumeration of any System Data Sources.
Throws:
Win32Exception - if any exception occurs.

getFileDataSources

public static final java.util.Enumeration getFileDataSources()
                                                      throws Win32Exception
Returns an Enumeration of any File Data Sources.

Returns:
the Enumeration of any File Data Sources.
Throws:
Win32Exception - if any exception occurs.

getDrivers

public static final java.util.Enumeration getDrivers()
                                              throws Win32Exception
Returns an Enumeration of any ODBC Drivers.

Returns:
the Enumeration of any ODBC Drivers.
Throws:
Win32Exception - if any exception occurs.

Servertec
Foundation Classes
1.3.3 09/04/2005

Copyright © 2001-2005 Servertec. All rights reserved.