FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
If JdbcRowSetImpl.setAutoCommit() is called before calling JdbcRowSetImpl.execute() it raises a NullPointerException.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run the attached program.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would expect no exception because it is stated in the doc RowSet are beans like API allowing to configure a connection to a database to retrieve rows. So I except to be able to set all the flags before calling the execute method.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.NullPointerException
at com.sun.rowset.JdbcRowSetImpl.setAutoCommit(JdbcRowSetImpl.java:4042)
at ilog.views.util.data.RowSetPb3.test(RowSetPb3.java:43)
at ilog.views.util.data.RowSetPb3.main(RowSetPb3.java:29)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package ilog.views.util.data;
import java.sql.SQLException;
import javax.sql.rowset.JdbcRowSet;
import com.sun.rowset.JdbcRowSetImpl;
/**
* @author jolif
*
*/
public class RowSetPb3
{
final static String databaseURL = "jdbc:mysql:///ilog_demos";
final static String user = "";
final static String passwd = "";
final static String driverName = "com.mysql.jdbc.Driver";
final static String TABLE_NAME = "activities";
public RowSetPb3()
{
}
// CJO 11/04
public static void main(String[] arg)
throws Exception
{
new RowSetPb3().test();
}
public void test() throws ClassNotFoundException, InstantiationException,
IllegalAccessException, SQLException, InterruptedException
{
Class.forName(driverName);
JdbcRowSet rowSet = new JdbcRowSetImpl();
rowSet.setUrl(databaseURL);
rowSet.setUsername(user);
rowSet.setPassword(passwd);
rowSet.setCommand("select * from "+TABLE_NAME);
rowSet.setAutoCommit(false);
rowSet.execute();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
call setAutoCommit after execute.
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
If JdbcRowSetImpl.setAutoCommit() is called before calling JdbcRowSetImpl.execute() it raises a NullPointerException.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run the attached program.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would expect no exception because it is stated in the doc RowSet are beans like API allowing to configure a connection to a database to retrieve rows. So I except to be able to set all the flags before calling the execute method.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.NullPointerException
at com.sun.rowset.JdbcRowSetImpl.setAutoCommit(JdbcRowSetImpl.java:4042)
at ilog.views.util.data.RowSetPb3.test(RowSetPb3.java:43)
at ilog.views.util.data.RowSetPb3.main(RowSetPb3.java:29)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package ilog.views.util.data;
import java.sql.SQLException;
import javax.sql.rowset.JdbcRowSet;
import com.sun.rowset.JdbcRowSetImpl;
/**
* @author jolif
*
*/
public class RowSetPb3
{
final static String databaseURL = "jdbc:mysql:///ilog_demos";
final static String user = "";
final static String passwd = "";
final static String driverName = "com.mysql.jdbc.Driver";
final static String TABLE_NAME = "activities";
public RowSetPb3()
{
}
// CJO 11/04
public static void main(String[] arg)
throws Exception
{
new RowSetPb3().test();
}
public void test() throws ClassNotFoundException, InstantiationException,
IllegalAccessException, SQLException, InterruptedException
{
Class.forName(driverName);
JdbcRowSet rowSet = new JdbcRowSetImpl();
rowSet.setUrl(databaseURL);
rowSet.setUsername(user);
rowSet.setPassword(passwd);
rowSet.setCommand("select * from "+TABLE_NAME);
rowSet.setAutoCommit(false);
rowSet.execute();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
call setAutoCommit after execute.