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

Khurram Faraaz commented on DRILL-2451:
---------------------------------------

I used the below snippet to verify, however I see an Exception.

{code}
                Class.forName("org.apache.drill.jdbc.Driver").newInstance();
                Connection conn = DriverManager.getConnection(URL_STRING,"","");
                Statement stmt = conn.createStatement();

                String query = "select * from FEWRWSPQQ_101";
                ResultSet rs = stmt.executeQuery(query);
                ResultSetMetaData rsmd = rs.getMetaData();

                while (rs.next()) {
                }
                conn.commit();

                if (rs != null)
                    rs.close();
                stmt.close();
                conn.close();
{code}

Here is the Exception I see when I compile and run the Java program

{code}
Can't call commit() in auto-commit mode.
org.apache.drill.jdbc.JdbcApiSqlException: Can't call commit() in auto-commit 
mode.
        at 
org.apache.drill.jdbc.impl.DrillConnectionImpl.commit(DrillConnectionImpl.java:192)
        at DataFromDrill.main(DataFromDrill.java:30)
{code}


> JDBC : Connection.commit throws an UnsupportedOperationException
> ----------------------------------------------------------------
>
>                 Key: DRILL-2451
>                 URL: https://issues.apache.org/jira/browse/DRILL-2451
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Client - JDBC
>            Reporter: Rahul Challapalli
>            Assignee: Rahul Challapalli
>             Fix For: 1.2.0
>
>
> git.commit.id.abbrev=e92db23
> Currently drill throws an UnsupportedOperationException when we call "commit" 
> on the Connection object. 
> I am not exactly sure what "commit" should do in the context of drill. But at 
> the very least doing nothing is better than throwing the above exception 
> since a few analytic tools might be using this method.
> Below is the documentation from the JDBC spec :
> {code}
> void commit() throws SQLException - Makes all changes made since the previous 
> commit/rollback permanent and releases any database locks currently held by 
> this Connection object. This method should be used only when auto-commit mode 
> has been disabled.
> Throws:
> SQLException - if a database access error occurs, this method is called while 
> participating in a distributed transaction, if this method is called on a 
> closed connection or this Connection object is in auto-commit mode
> {code}



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

Reply via email to