Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 332343 - Derby ClientDataSourceFactory creates an "embedded" connection even when configured for client access
Summary: Derby ClientDataSourceFactory creates an "embedded" connection even when conf...
Status: CLOSED INVALID
Alias: None
Product: Gemini.DBaccess
Classification: RT
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-10 16:25 EST by Tom Ware CLA
Modified: 2010-12-13 08:09 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Ware CLA 2010-12-10 16:25:44 EST
public DataSource createDataSource(Properties props) throws SQLException {
        if (props == null) props = new Properties();
        if (props.get(DataSourceFactory.JDBC_URL) != null) {
            return new UrlBasedDriverDataSource(props);
        } else {
            DataSource dataSource = (jdbc4) 
                ? new ClientDataSource40()
                : new ClientDataSource();
            setDataSourceProperties(dataSource, props);
            return dataSource;
        }
    }

Notice 

        if (props.get(DataSourceFactory.JDBC_URL) != null) {
            return new UrlBasedDriverDataSource(props);

The constructor here is like this:


    public UrlBasedDriverDataSource(Properties properties) {
        this(properties, true);
    }

  the second argument, "true" indicates is for the "embedded" property, so it makes datasource think it is for an embedded driver rather than a client driver

  This causes a test failure.

Fix:


        if (props.get(DataSourceFactory.JDBC_URL) != null) {
            return new UrlBasedDriverDataSource(props, false);


With this fix, the test passes
Comment 1 Tom Ware CLA 2010-12-13 08:09:11 EST
Appears to be fixed already.