db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lance J. Andersen" <Lance.Ander...@Sun.COM>
Subject Re: JDBC auto-commit semantics challenge
Date Wed, 13 Jul 2005 15:29:43 GMT
a recap would be good.

The wording that is in the spec was made based on the input from the EG 
which includes IBM, Oracle and mysql.

Please put a writeup together and I will discuss it with my EG.

Thanks Lance

p.s.  Yes it is hard to follow as there have been a slew of emails on 
derby-dev and I am way behind due to JavaOne and the Sun shutdown.



Philip Wilder wrote:

> I'm a little concerned that this issue seems to be withering on the 
> vine so to speak so I thought I would bring it back to the attention 
> of the dev list again.
>
> In an effort to collect more information I have been running simple 
> tests such as the one I've attached to this email against db2, oracle 
> and mysql. The JDBC 4.0 specifications state that a ResultSet will 
> close "if the cursor is forward only, then when invocation of its next 
> method returns
> false". Yet none of the Databases I've tested do this, including Derby 
> Embedded. The only test to follow this behavior I've found was Derby 
> Client and this way have played some part in the SQuirreL malfunction 
> mentioned earlier.
>
> So will JDBC 4.0 "break" these drivers in this respect or is there 
> some other resolution?
>
> On a related note would anyone find it beneficial if I were to collect 
> this thread into one document and posted it to the newsgroup? This 
> issue has gone on for some time now and I can understand if anyone is 
> having trouble following the thread.
>
> Philip
>
> Dan Debrunner wrote:
>
>> Kathey Marsden wrote:
>>
>>  
>>
>>>> Lance J. Andersen wrote:
>>>>
>>>>
>>>   
>>>
>>>>>> I am just getting back from J1 and I have a quite a few emails to

>>>>>> wade
>>>>>> through.  If/when you hace a cycle, if you can summarize the issues
>>>>>> outstanding, i can look at it and discuss with the EG.  There are

>>>>>> sooo
>>>>>> many emails from derby-dev, it is going to take me quite some 
>>>>>> time to
>>>>>> digest it all.
>>>>>>
>>>>     
>>>>
>>>> Hi Lance,
>>>>
>>>> Yes,  there is a lot of mail.  At least this thread would be worth
>>>> reading  in its entirety.   The executive summary as Philip would 
>>>> put it
>>>> is that
>>>
>>>   
>>
>>
>>  
>>
>>>>
>>>> Regarding the spec, the biggest items resolve to me seem to me to be.
>>>>
>>>>     -   When is a result set closed and when should next return 
>>>> false vs
>>>> throw an exception?
>>>
>>>   
>>
>>
>>
>> I think it is well defined when a result set is closed, I think it's
>> more once it is closed, what should its methods do? Especially
>> rs.next(), return false or throw an exception. At least, for Lance & the
>> EG, I think we need a better question than "when is a result set 
>> closed'.
>>
>> Dan.
>>
>>
>>  
>>
>------------------------------------------------------------------------
>
>import java.sql.Connection;
>import java.sql.DriverManager;
>import java.sql.ResultSet;
>import java.sql.ResultSetMetaData;
>import java.sql.SQLException;
>import java.sql.Statement;
>import java.util.Properties;
>
>public class SimpleResultSetTest {
>
>    public static void main(String[] args) {
>        try {
>            //Change based on the database in use
>            final String driver = "com.mysql.jdbc.Driver";
>            final String protocol = "jdbc:mysql://localhost:3306/testDB";
>            final String username = "root";
>            final String password = "password";
>            
>            Class.forName(driver).newInstance();
>            Connection conn = null;
>            Properties props = new Properties();
>            props.put("user", username);
>            props.put("password", password);
>    
>            conn = DriverManager.getConnection(protocol, props);
>            Statement s = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
>            try {
>                s.executeUpdate("create table t1 (num int)");
>            } catch (SQLException e) {
>                //Table already exists, remove rows
>                s.executeUpdate("delete from t1");
>            }
>            
>            s.executeUpdate("insert into t1 values (1)");
>            s.executeUpdate("insert into t1 values (2)");
>            ResultSet rs = s.executeQuery("select * from t1");
>            
>            while (rs.next()) {
>                System.out.println(rs.getString(1));
>            }
>            try {
>                ResultSetMetaData rsmd = rs.getMetaData();
>                System.out.println(rsmd.getColumnCount());
>                System.out.println(rs.next()); //No Exception yet
>                rs.close();
>                System.out.println(rs.next()); //Exception
>            } catch (SQLException e) {
>                e.printStackTrace();
>            }
>            rs.close();
>            s.executeUpdate("drop table t1");
>            s.close();
>            conn.close();
>        } catch (Exception ex) {
>            ex.printStackTrace();
>        }
>    }
>}
>  
>

Mime
View raw message