You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Cathy Daw (JIRA)" <ji...@apache.org> on 2011/06/02 01:42:47 UTC

[jira] [Created] (CASSANDRA-2732) StringIndexOutOfBoundsException when specifying JDBC connection string without user and password

StringIndexOutOfBoundsException when specifying JDBC connection string without user and password
------------------------------------------------------------------------------------------------

                 Key: CASSANDRA-2732
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2732
             Project: Cassandra
          Issue Type: Bug
    Affects Versions: 0.8 beta 1
            Reporter: Cathy Daw
            Priority: Trivial


*PASS: specify connection string user and password*
_connection = DriverManager.getConnection("jdbc:cassandra:root/root@localhost:9170/default")_

*FAIL: specify connection string without user and password*
_connection = DriverManager.getConnection("jdbc:cassandra://localhost:9170/default")_
{code}
[junit] String index out of range: -1
[junit] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
[junit] at java.lang.String.substring(String.java:1937)
[junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
[junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
[junit] at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:86)
[junit] at java.sql.DriverManager.getConnection(DriverManager.java:582)
[junit] at java.sql.DriverManager.getConnection(DriverManager.java:207)
[junit] at com.datastax.cql.runJDBCSmokeTest.setUpBeforeClass(runJDBCSmokeTest.java:45)
{code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (CASSANDRA-2732) StringIndexOutOfBoundsException when specifying JDBC connection string without user and password

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Ellis reassigned CASSANDRA-2732:
-----------------------------------------

    Assignee: Rick Shaw

Rick, do you want to take a stab at this?

> StringIndexOutOfBoundsException when specifying JDBC connection string without user and password
> ------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2732
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2732
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 0.8 beta 1
>            Reporter: Cathy Daw
>            Assignee: Rick Shaw
>            Priority: Trivial
>              Labels: cql
>
> *PASS: specify connection string user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra:root/root@localhost:9170/default")_
> *FAIL: specify connection string without user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra://localhost:9170/default")_
> {code}
> [junit] String index out of range: -1
> [junit] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> [junit] at java.lang.String.substring(String.java:1937)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:86)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:582)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:207)
> [junit] at com.datastax.cql.runJDBCSmokeTest.setUpBeforeClass(runJDBCSmokeTest.java:45)
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-2732) StringIndexOutOfBoundsException when specifying JDBC connection string without user and password

Posted by "Rick Shaw (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13045104#comment-13045104 ] 

Rick Shaw commented on CASSANDRA-2732:
--------------------------------------

I looked at this area quite extensively in updating the semantics for the JDBC C* suite.

The issue is that the current implementation is very strict in its requested format. It accepts no variations, including requiring the username and password in the URI. But none of the auth/auth stuff was even hooked up to the Thrift connection so it was really not going anywhere anyway. Not to mention that the URI is really not a very wise place to put a password anyway. 

In a revised implementation I have used the URI parser in the java.util library. It offers a wealth of error checking and defaulting to happen (with judicious enhancements).

This proposed implementation can handle any supportable URI variation after the required "java:cassandra". The implementation defaults to "localhost" as a site and "9160" as a port so it can be as simple as : "jdbc:cassandra:/Test".

Using the URI library did cause one small incompatibility: The credentials of UN and PW need to NOT use a slash "/" to separate them. It confuses it with other parts of a standard URI (in this case the start of the "path"). I chose the semicolon ";" for now but colon (":" works as well and seems like it fits in as well... I'd gladly listen to other approaches??

So a more robust example URI would be "jdbc:cassandra://user;secret@my.host.com:9170/Standard".

I also hooked up the Properties argument in the constructor so you can use the Properties argument or the user and password arguments in {{DriverMananger}} or {{DriverManagerConnectionFactory}} or similar classes. Note that now if you include the UN/PW anywhere it will attempt to use it. So you need to mean it...

I will be cutting a new JIRA ticket for the comprehensive patch. I will point this ticket to it when it hits.

But discussion on this point is very welcome.




> StringIndexOutOfBoundsException when specifying JDBC connection string without user and password
> ------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2732
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2732
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 0.8 beta 1
>            Reporter: Cathy Daw
>            Assignee: Rick Shaw
>            Priority: Trivial
>              Labels: cql
>
> *PASS: specify connection string user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra:root/root@localhost:9170/default")_
> *FAIL: specify connection string without user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra://localhost:9170/default")_
> {code}
> [junit] String index out of range: -1
> [junit] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> [junit] at java.lang.String.substring(String.java:1937)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:86)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:582)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:207)
> [junit] at com.datastax.cql.runJDBCSmokeTest.setUpBeforeClass(runJDBCSmokeTest.java:45)
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-2732) StringIndexOutOfBoundsException when specifying JDBC connection string without user and password

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13045138#comment-13045138 ] 

Jonathan Ellis commented on CASSANDRA-2732:
-------------------------------------------

It looks like mysql and postgresql both use uri parameters for those--"jdbc:cassandra://my.host.com:9170/Standard&user=X&password=Y", which makes sense to me.

I confess to being mystified as to how JDBC knows what parameters a Connection constructor expects -- doesn't seem to be any rhyme or reason there.

> StringIndexOutOfBoundsException when specifying JDBC connection string without user and password
> ------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2732
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2732
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 0.8 beta 1
>            Reporter: Cathy Daw
>            Assignee: Rick Shaw
>            Priority: Trivial
>              Labels: cql
>
> *PASS: specify connection string user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra:root/root@localhost:9170/default")_
> *FAIL: specify connection string without user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra://localhost:9170/default")_
> {code}
> [junit] String index out of range: -1
> [junit] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> [junit] at java.lang.String.substring(String.java:1937)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:86)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:582)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:207)
> [junit] at com.datastax.cql.runJDBCSmokeTest.setUpBeforeClass(runJDBCSmokeTest.java:45)
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-2732) StringIndexOutOfBoundsException when specifying JDBC connection string without user and password

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050584#comment-13050584 ] 

Jonathan Ellis commented on CASSANDRA-2732:
-------------------------------------------

Is this subsumed by CASSANDRA-2754?

> StringIndexOutOfBoundsException when specifying JDBC connection string without user and password
> ------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2732
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2732
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 0.8 beta 1
>            Reporter: Cathy Daw
>            Assignee: Rick Shaw
>            Priority: Trivial
>              Labels: cql
>
> *PASS: specify connection string user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra:root/root@localhost:9170/default")_
> *FAIL: specify connection string without user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra://localhost:9170/default")_
> {code}
> [junit] String index out of range: -1
> [junit] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> [junit] at java.lang.String.substring(String.java:1937)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:86)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:582)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:207)
> [junit] at com.datastax.cql.runJDBCSmokeTest.setUpBeforeClass(runJDBCSmokeTest.java:45)
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CASSANDRA-2732) StringIndexOutOfBoundsException when specifying JDBC connection string without user and password

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Ellis resolved CASSANDRA-2732.
---------------------------------------

    Resolution: Duplicate
      Assignee:     (was: Rick Shaw)

> StringIndexOutOfBoundsException when specifying JDBC connection string without user and password
> ------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2732
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2732
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 0.8 beta 1
>            Reporter: Cathy Daw
>            Priority: Trivial
>              Labels: cql
>
> *PASS: specify connection string user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra:root/root@localhost:9170/default")_
> *FAIL: specify connection string without user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra://localhost:9170/default")_
> {code}
> [junit] String index out of range: -1
> [junit] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> [junit] at java.lang.String.substring(String.java:1937)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:86)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:582)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:207)
> [junit] at com.datastax.cql.runJDBCSmokeTest.setUpBeforeClass(runJDBCSmokeTest.java:45)
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CASSANDRA-2732) StringIndexOutOfBoundsException when specifying JDBC connection string without user and password

Posted by "Vivek Mishra (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050929#comment-13050929 ] 

Vivek Mishra commented on CASSANDRA-2732:
-----------------------------------------

By specifying cassandra.properties, i mean defining cassandra specific properties and loading them implicitly just like having jdbc.properties, any sql client holds or hibernate.properties held by Hibernate.



> StringIndexOutOfBoundsException when specifying JDBC connection string without user and password
> ------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2732
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2732
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 0.8 beta 1
>            Reporter: Cathy Daw
>            Assignee: Rick Shaw
>            Priority: Trivial
>              Labels: cql
>
> *PASS: specify connection string user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra:root/root@localhost:9170/default")_
> *FAIL: specify connection string without user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra://localhost:9170/default")_
> {code}
> [junit] String index out of range: -1
> [junit] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> [junit] at java.lang.String.substring(String.java:1937)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:86)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:582)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:207)
> [junit] at com.datastax.cql.runJDBCSmokeTest.setUpBeforeClass(runJDBCSmokeTest.java:45)
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CASSANDRA-2732) StringIndexOutOfBoundsException when specifying JDBC connection string without user and password

Posted by "Vivek Mishra (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049749#comment-13049749 ] 

Vivek Mishra commented on CASSANDRA-2732:
-----------------------------------------

Specifying property set is supported by JDBC. But putting something like cassandra.properties can be more useful as it will allow us to put more configurable parameters may be needed in future, like batch flush, batch fetch etc etc.

> StringIndexOutOfBoundsException when specifying JDBC connection string without user and password
> ------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2732
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2732
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 0.8 beta 1
>            Reporter: Cathy Daw
>            Assignee: Rick Shaw
>            Priority: Trivial
>              Labels: cql
>
> *PASS: specify connection string user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra:root/root@localhost:9170/default")_
> *FAIL: specify connection string without user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra://localhost:9170/default")_
> {code}
> [junit] String index out of range: -1
> [junit] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> [junit] at java.lang.String.substring(String.java:1937)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:86)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:582)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:207)
> [junit] at com.datastax.cql.runJDBCSmokeTest.setUpBeforeClass(runJDBCSmokeTest.java:45)
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CASSANDRA-2732) StringIndexOutOfBoundsException when specifying JDBC connection string without user and password

Posted by "Vivek Mishra (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049748#comment-13049748 ] 

Vivek Mishra commented on CASSANDRA-2732:
-----------------------------------------

Does it mean specifiying something like cassandra.properties to hold these parameters and loading them up with DriverManager. Will it make  getting a jdbc connection without even specifying a URI? 

In this we can remove such checks for '@' or something like this. 

As i believe username and password as part of connection parameters doesn't make much sense with Cassandra.



> StringIndexOutOfBoundsException when specifying JDBC connection string without user and password
> ------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2732
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2732
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 0.8 beta 1
>            Reporter: Cathy Daw
>            Assignee: Rick Shaw
>            Priority: Trivial
>              Labels: cql
>
> *PASS: specify connection string user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra:root/root@localhost:9170/default")_
> *FAIL: specify connection string without user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra://localhost:9170/default")_
> {code}
> [junit] String index out of range: -1
> [junit] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> [junit] at java.lang.String.substring(String.java:1937)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:86)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:582)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:207)
> [junit] at com.datastax.cql.runJDBCSmokeTest.setUpBeforeClass(runJDBCSmokeTest.java:45)
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CASSANDRA-2732) StringIndexOutOfBoundsException when specifying JDBC connection string without user and password

Posted by "Rick Shaw (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13042791#comment-13042791 ] 

Rick Shaw commented on CASSANDRA-2732:
--------------------------------------

A quick look at the code shows that its first step is to fin an "@" in the string and start the splitting based on that result. But it gets a -1 back and then tries to use that in substring... :(

So my quick first response is make the URL look more like the "successful" one with an "@" but dropping the UN/PW.

This seems to be a pretty fragile area. I have been asked by others to look at why the UN/PW does not seem to have any effect. So I expect there is more detailed work ahead.

> StringIndexOutOfBoundsException when specifying JDBC connection string without user and password
> ------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2732
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2732
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 0.8 beta 1
>            Reporter: Cathy Daw
>            Assignee: Rick Shaw
>            Priority: Trivial
>              Labels: cql
>
> *PASS: specify connection string user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra:root/root@localhost:9170/default")_
> *FAIL: specify connection string without user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra://localhost:9170/default")_
> {code}
> [junit] String index out of range: -1
> [junit] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> [junit] at java.lang.String.substring(String.java:1937)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:86)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:582)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:207)
> [junit] at com.datastax.cql.runJDBCSmokeTest.setUpBeforeClass(runJDBCSmokeTest.java:45)
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-2732) StringIndexOutOfBoundsException when specifying JDBC connection string without user and password

Posted by "Rick Shaw (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13042588#comment-13042588 ] 

Rick Shaw commented on CASSANDRA-2732:
--------------------------------------

Sure... in for a penny...



> StringIndexOutOfBoundsException when specifying JDBC connection string without user and password
> ------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2732
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2732
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 0.8 beta 1
>            Reporter: Cathy Daw
>            Assignee: Rick Shaw
>            Priority: Trivial
>              Labels: cql
>
> *PASS: specify connection string user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra:root/root@localhost:9170/default")_
> *FAIL: specify connection string without user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra://localhost:9170/default")_
> {code}
> [junit] String index out of range: -1
> [junit] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> [junit] at java.lang.String.substring(String.java:1937)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:86)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:582)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:207)
> [junit] at com.datastax.cql.runJDBCSmokeTest.setUpBeforeClass(runJDBCSmokeTest.java:45)
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-2732) StringIndexOutOfBoundsException when specifying JDBC connection string without user and password

Posted by "Rick Shaw (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049754#comment-13049754 ] 

Rick Shaw commented on CASSANDRA-2732:
--------------------------------------

With the new changes a special cassandra properties file will not be necessary.

You may now use the properties argument in the DriverManager (or the username and password arguments) it is also fully supported in the factory methods. It works with Datasources as well.

I agree that the URI is not the right place for user and password but it will continue to be supported for convenience. The properties or the un/pw arguments to the Drivermanager will alway take precedence.

Any additional helpful parameters to give hints to the driver are supposed to be passed in this fashion. There just are not any that are supported yet. When we support built in pooling (external pooling of connection works now) those arguments you spoke of will be passed in the properties argument as well.

The goal is this should look and feel like any other JDBC driver for a DB with the few limitations that are unique to C*.

> StringIndexOutOfBoundsException when specifying JDBC connection string without user and password
> ------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2732
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2732
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 0.8 beta 1
>            Reporter: Cathy Daw
>            Assignee: Rick Shaw
>            Priority: Trivial
>              Labels: cql
>
> *PASS: specify connection string user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra:root/root@localhost:9170/default")_
> *FAIL: specify connection string without user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra://localhost:9170/default")_
> {code}
> [junit] String index out of range: -1
> [junit] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> [junit] at java.lang.String.substring(String.java:1937)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:86)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:582)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:207)
> [junit] at com.datastax.cql.runJDBCSmokeTest.setUpBeforeClass(runJDBCSmokeTest.java:45)
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CASSANDRA-2732) StringIndexOutOfBoundsException when specifying JDBC connection string without user and password

Posted by "Rick Shaw (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050667#comment-13050667 ] 

Rick Shaw commented on CASSANDRA-2732:
--------------------------------------

Yes. that is where the patch is. (i'll have an updated patch today)

> StringIndexOutOfBoundsException when specifying JDBC connection string without user and password
> ------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2732
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2732
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 0.8 beta 1
>            Reporter: Cathy Daw
>            Assignee: Rick Shaw
>            Priority: Trivial
>              Labels: cql
>
> *PASS: specify connection string user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra:root/root@localhost:9170/default")_
> *FAIL: specify connection string without user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra://localhost:9170/default")_
> {code}
> [junit] String index out of range: -1
> [junit] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> [junit] at java.lang.String.substring(String.java:1937)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:86)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:582)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:207)
> [junit] at com.datastax.cql.runJDBCSmokeTest.setUpBeforeClass(runJDBCSmokeTest.java:45)
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CASSANDRA-2732) StringIndexOutOfBoundsException when specifying JDBC connection string without user and password

Posted by "Rick Shaw (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13045167#comment-13045167 ] 

Rick Shaw commented on CASSANDRA-2732:
--------------------------------------

Oracle is even worse... It was very early to the game so it is not even a legal URI... Ultra special case parsing... UGG...

Using the URI library make any final decision reasonably easy if it is a legal URI... But it is really so much more flexible to use the Properties or UN/PW arguments to the DeviceManager factory and drive with injection and the like... and not pass the username and password in the URI. But for quick solutions it is simple and nice to have. 

As to the constructor. It thinks the Connection interface is at the other end of the {{Driver}} interface which has the required method {{connect(String,Properties)}} returning a {{Connection}}. So those are the nuggets of info available to the Driver to make a connection. Of course the implementation of the {{Connection}} can specify whatever it wants but it should at least get those two from the {{Driver}} implementation. 

> StringIndexOutOfBoundsException when specifying JDBC connection string without user and password
> ------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2732
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2732
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 0.8 beta 1
>            Reporter: Cathy Daw
>            Assignee: Rick Shaw
>            Priority: Trivial
>              Labels: cql
>
> *PASS: specify connection string user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra:root/root@localhost:9170/default")_
> *FAIL: specify connection string without user and password*
> _connection = DriverManager.getConnection("jdbc:cassandra://localhost:9170/default")_
> {code}
> [junit] String index out of range: -1
> [junit] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> [junit] at java.lang.String.substring(String.java:1937)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:74)
> [junit] at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:86)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:582)
> [junit] at java.sql.DriverManager.getConnection(DriverManager.java:207)
> [junit] at com.datastax.cql.runJDBCSmokeTest.setUpBeforeClass(runJDBCSmokeTest.java:45)
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira