Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 332343

Summary: Derby ClientDataSourceFactory creates an "embedded" connection even when configured for client access
Product: [RT] Gemini.DBaccess Reporter: Tom Ware <tom.ware>
Component: CoreAssignee: Project Inbox <gemini.dbaccess-inbox>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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.