[ 
https://issues.apache.org/jira/browse/SOLR-7986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14741368#comment-14741368
 ] 

Uwe Schindler commented on SOLR-7986:
-------------------------------------

One thing about your Driver:

According to spec, the driver should return "null", if the URL does not fit the 
driver. So basically do: {{if (!acceptURL(url)) return null;}}
This is made for very early consumers that rely on that behaviour, see docs:

{quote}
Attempts to make a database connection to the given URL. The driver should 
return "null" if it realizes it is the wrong kind of driver to connect to the 
given URL. This will be common, as when the JDBC driver manager is asked to 
connect to a given URL it passes the URL to each loaded driver in turn.
The driver should throw an SQLException if it is the right driver to connect to 
the given URL but has trouble connecting to the database.
The java.util.Properties argument can be used to pass arbitrary string 
tag/value pairs as connection arguments. Normally at least "user" and 
"password" properties should be included in the Properties object.
{quote}

Your driver will completely fail with string parsing exceptions, I assume.

> JDBC Driver for SQL Interface
> -----------------------------
>
>                 Key: SOLR-7986
>                 URL: https://issues.apache.org/jira/browse/SOLR-7986
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>    Affects Versions: Trunk
>            Reporter: Joel Bernstein
>         Attachments: SOLR-7986-SPI.patch, SOLR-7986.patch, SOLR-7986.patch, 
> SOLR-7986.patch, SOLR-7986.patch, SOLR-7986.patch, SOLR-7986.patch, 
> SOLR-7986.patch
>
>
> This ticket is to create a JDBC Driver (thin client) for the new SQL 
> interface (SOLR-7560). As part of this ticket a driver will be added to the 
> Solrj libary under the package: *org.apache.solr.client.solrj.io.sql*
> Initial implementation will include basic *Driver*, *Connection*, *Statement* 
> and *ResultSet* implementations.
> Future releases can build on this implementation to support a wide range of 
> JDBC clients and tools.
> *Syntax using parallel Map/Reduce for aggregations*:
> {code}
> Properties props = new Properties();
> props.put("aggregationMode", "map_reduce");
> props.put("numWorkers", "10");
> Class.forName("org.apache.solr.client.solrj.io.sql.DriverImpl").newInstance();
> Connection con = 
> DriverManager.getConnection("jdbc:solr://<zkhost:port>?collection=<collection>",
>  props);
> Statement stmt = con.createStatement();
> ResultSet rs = stmt.executeQuery("select a, sum(b) from tablex group by a 
> having sum(b) > 100");
> while(rs.next()) {
>     String a = rs.getString("a");
>     double sumB = rs.getDouble("sum(b)");
> }
> {code} 
> *Syntax using JSON facet API for aggregations*:
> {code}
> Properties props = new Properties();
> props.put("aggregationMode", "facet");
> Class.forName("org.apache.solr.client.solrj.io.sql.DriverImpl").newInstance();
> Connection con = 
> DriverManager.getConnection("jdbc:solr://<zkhost:port>?collection=<collection>",
>  props);
> Statement stmt = con.createStatement();
> ResultSet rs = stmt.executeQuery("select a, sum(b) from tablex group by a 
> having sum(b) > 100");
> while(rs.next()) {
>     String a = rs.getString("a");
>     double sumB = rs.getDouble("sum(b)");
> }
> {code}
>  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to