org.modeshape.connector.meta.jdbc
Class SqlServerMetadataCollector

java.lang.Object
  extended by org.modeshape.connector.meta.jdbc.JdbcMetadataCollector
      extended by org.modeshape.connector.meta.jdbc.SqlServerMetadataCollector
All Implemented Interfaces:
MetadataCollector

public class SqlServerMetadataCollector
extends JdbcMetadataCollector

The Microsoft SQL Server JDBC drivers return a list of users from the DatabaseMetaData.getSchemas() method instead of the actual schemas. Unfortunately, the DatabaseMetaData.getTables(String, String, String, String[]) method actually returns schema names, so the default JdbcMetadataCollector implementation doesn't match up correctly. This class should be used when the Microsoft JDBC driver is used for database connectivity. The jTDS driver has already corrected this bug and can use the default JdbcMetadataCollector.


Constructor Summary
SqlServerMetadataCollector()
           
 
Method Summary
 List<String> getSchemaNames(Connection conn, String catalogName)
          Return the list of schema names that currently exist in the database to which connection is connected within the named catalog.
 
Methods inherited from class org.modeshape.connector.meta.jdbc.JdbcMetadataCollector
getCatalogNames, getColumns, getProcedures, getTables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlServerMetadataCollector

public SqlServerMetadataCollector()
Method Detail

getSchemaNames

public List<String> getSchemaNames(Connection conn,
                                   String catalogName)
                            throws JdbcMetadataException
Description copied from class: JdbcMetadataCollector
Return the list of schema names that currently exist in the database to which connection is connected within the named catalog. If catalogName is null, then all schema names should be returned regardless of the catalog with which they are associated. The schema names must be sorted in a manner that is stable between successive calls to this method.

Specified by:
getSchemaNames in interface MetadataCollector
Overrides:
getSchemaNames in class JdbcMetadataCollector
Parameters:
conn - the connection to the database; must not be non-null and must be open. This connection should not be closed by this method.
catalogName - the name of the catalog to which returned schemas must belong, or null if all schemas are to be returned
Returns:
An ordered list of the schemas in the database, or an empty list if no schemas exist; may not be null
Throws:
JdbcMetadataException - if the schema names cannot be retrieved
See Also:
MetadataCollector.getSchemaNames(java.sql.Connection, java.lang.String)


Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.