[ 
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

Reply via email to