/** * Returns the data source for the EPSG database. If no data source has been previously * {@linkplain #setDataSource set}, then this method invokes {@link #createDataSource}. * <strong>Note:</strong> invoking this method may force immediate connection to the EPSG * database. * * @return The data source. * @throws SQLException if the connection to the EPSG database failed. * @see #setDataSource * @see #createDataSource */ public final synchronized DataSource getDataSource() throws SQLException { if (datasource == null) { // Force the creation of the underlying backing store. It will invokes // (indirectly) createBackingStore, which will fetch the DataSource. if (!super.isAvailable()) { // Connection failed, but the exception is not available. datasource = null; throw new SQLException(Errors.format(ErrorKeys.NO_DATA_SOURCE)); } } return datasource; }