Issue Details (XML | Word | Printable)

Key: DERBY-530
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Kathey Marsden
Reporter: Piet Blok
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Derby

ClientDriver ignores Properties object in connect(String url, Properties connectionProperties) method

Created: 24/Aug/05 12:25 AM   Updated: 20/Mar/07 09:54 PM
Return to search
Component/s: Network Client
Affects Version/s: 10.1.1.0
Fix Version/s: 10.1.2.1, 10.2.1.6

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works DERBY530.diff 2005-09-10 05:03 AM Kathey Marsden 32 kB
Environment: windows XP, JRE 1.5.0_04
Issue Links:
Dependants
 

Resolution Date: 17/Sep/05 08:07 AM


 Description  « Hide
In contrast to EmbeddedDriver, a connection attribute create=true is not recognized when presented as a property in a Properties object.

 As a workaround I append the attributes from the Properties object to the url string before invoking the connect() method: then a new database is created and a connection is established.

Next code fragment illustrates the bug and the workaround:



    private static final ClientDriver clientDriver = new ClientDriver();


    private Connection getClientConnection(String database,
            Properties connectionProperties) throws SQLException {
        try {
            System.out.println("Try to connect with properties");
            String connectionURL = "jdbc:derby://127.0.0.1:1527/" + database;
            System.out.println("connectionURL: " + connectionURL);
            Connection rv = clientDriver.connect(connectionURL,
                    connectionProperties);
            System.out.println("Connection: " + rv);
            return rv;
        } catch (SQLException e) {
            System.out.println("Try to connect with URL attributes");
            StringBuffer sb = new StringBuffer();
            for (Enumeration enu = connectionProperties.propertyNames(); enu
                    .hasMoreElements();) {
                String key = (String) enu.nextElement();
                sb.append(';');
                sb.append(key);
                sb.append('=');
                sb.append(connectionProperties.getProperty(key, ""));
            }
            String connectionURL = "jdbc:derby://127.0.0.1:1527/" + database
                    + sb.toString();
            System.out.println("connectionURL: " + connectionURL);
            Connection rv = clientDriver.connect(connectionURL,
                    connectionProperties);
            System.out.println("Connection: " + rv);
            System.out
                    .println("!!!!!!!!!!! seems a bug: Properties argument in ClientDriver.connect(String, Properties) has not been used");
            return rv;
        }
    }



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Kathey Marsden made changes - 01/Sep/05 12:56 PM
Field Original Value New Value
Assignee Kathey Marsden [ kmarsden ]
Kathey Marsden made changes - 10/Sep/05 05:03 AM
Attachment DERBY530.diff [ 12312811 ]
Kathey Marsden made changes - 17/Sep/05 08:07 AM
Fix Version/s 10.2.0.0 [ 11187 ]
Resolution Fixed [ 1 ]
Fix Version/s 10.1.2.0 [ 12310270 ]
Status Open [ 1 ] Resolved [ 5 ]
Kathey Marsden made changes - 17/Sep/05 08:12 AM
Link This issue blocks DERBY-559 [ DERBY-559 ]
Deepa Remesh made changes - 30/Sep/05 02:30 AM
Fix Version/s 10.1.1.1 [ 12310332 ]
Andrew McIntyre made changes - 20/Mar/07 09:54 PM
Status Resolved [ 5 ] Closed [ 6 ]