It's not a secret anymore!*
The moose likes JDBC and the fly likes exception when I use moveTo InsertRow Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "exception when I use moveTo InsertRow" Watch "exception when I use moveTo InsertRow" New topic
Author

exception when I use moveTo InsertRow

leire_etxeberria
Greenhorn

Joined: Sep 05, 2001
Posts: 3
I�m working with an Access bd and
the driver "sun.jdbc.odbc.JdbcOdbcDriver"
and when I try to insert a row using
result.moveToInsertRow() gives an
exception:
java.lang.ArrayIndexOutOfBoundsException

I have not problems with others things of
JDBC 2.0 API.
I don't know if it's a problem of the
access bd that doesn't let do that,
how can I know if it's posible to
use moveToInsertRow with Access.
Thanks and Sorry, my English is very bad.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

It may be helpful to post the offending code (the statement, and resultset lifespan). It may help shed a little more light on the problem.
Jamie
leire_etxeberria
Greenhorn

Joined: Sep 05, 2001
Posts: 3
This is the code
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc dbc:alumnos");
stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
result = stmt.executeQuery("select * from alumnos");

...

result.moveToInsertRow(); //Here it gives the exeption
result.updateInt("IDAL",Integer.valueOf(txtIdal.getText()).intValue());
result.updateString("NOMBRE",txtNombre.getText() );
result.updateString("PRIMER_APELLIDO",txtApel1.getText() );
result.updateString("SEGUNDO_APELLIDO",txtApel2.getText() );
result.insertRow();
result.moveToCurrentRow();
...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: exception when I use moveTo InsertRow
 
Similar Threads
transaction in session bean
UrlyBird:different ways for conection
about Bussiness Delegate in sequence diagram
ValueObject pattern question
DI or BD using EJB 3