You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Kathey Marsden (JIRA)" <de...@db.apache.org> on 2005/09/06 18:32:31 UTC

[jira] Commented: (DERBY-530) ClientDriver ignores Properties object in connect(String url, Properties connectionProperties) method

    [ http://issues.apache.org/jira/browse/DERBY-530?page=comments#action_12322749 ] 

Kathey Marsden commented on DERBY-530:
--------------------------------------

Currently the client sends all attributes specified in the the url to the server in the RDBNAM parameter of the ACCSEC command.  This includes  any client attributes (which the server ignores).  It does not however make proper consideration for the properties specified in the info parameter of the connect(String url, Properties info) method.  Another issue with the current approach is that user and password attributes get passed to the server without encryption if specified with the url.
 

I propose to fix this issue by sending  both the properties specified in the info parameter and those specified in the url to the server in the RDBNAM. user and password attributes will be the exception.  user and password  will be sent via the standard DRDA mechanism and excluded from the attributes sent with RDBNAM whether specified with the url or info properties.   As a result of the combination, the order of attributes sent to the server may be different than originally specified in the URL.




> ClientDriver ignores Properties object in connect(String url, Properties connectionProperties) method
> -----------------------------------------------------------------------------------------------------
>
>          Key: DERBY-530
>          URL: http://issues.apache.org/jira/browse/DERBY-530
>      Project: Derby
>         Type: Bug
>   Components: Network Client
>     Versions: 10.1.1.0
>  Environment: windows XP, JRE 1.5.0_04
>     Reporter: Piet Blok
>     Assignee: Kathey Marsden

>
> 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;
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira