Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problemi con insertRow();

1 view
Skip to first unread message

Doxer

unread,
Nov 20, 2009, 9:31:39 AM11/20/09
to
ciao a tutti,
ho questo problema devo replicare una parte di un database all'interno
dello stesso modificando qualche parametro, il problema è che facendo
l'insertRow mi dà un eccezione.
Il primo campo è autoincrementale.

grazie mille

l'eccezione è java.sql.SQLException: [Microsoft][Driver ODBC Microsoft
Access]Errore nella riga
at sun.jdbc.odbc.JdbcOdbcResultSet.setPos
(JdbcOdbcResultSet.java:5271)
at sun.jdbc.odbc.JdbcOdbcResultSet.insertRow
(JdbcOdbcResultSet.java:4131)

Codice

void access(){
String sql=new String("");
long last_id,id_univoco,id_lista;
String den_list=new String("");
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection
("jdbc:odbc:DB");
System.out.println("Connessione OK");
Statement stat = con.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);

sql = "SELECT * FROM inverter_params where id_lista=44814
order by Ordine_lista";
ResultSet rst = stat.executeQuery(sql);
ResultSet rstSave = stat.executeQuery("SELECT * FROM
inverter_params");

rst.last();
last_id=rst.getInt("ID");
id_univoco=rst.getInt("Id_Univoco");
den_list=rst.getString("Denominazione_lista");
id_lista=rst.getInt("Id_lista");
System.out.println(last_id);
id_lista++;
while(id_lista<=44921)
{
int nastro=Integer.parseInt(den_list.substring
(23,25));
System.out.println(nastro);
rst.first();
nastro++;
den_list="PARAMETRI FC301 NASTRO "+nastro;
System.out.println(den_list);
short ordine=0;
while(rst.next())
{
last_id++;
id_univoco++;
ordine++;
rstSave.moveToInsertRow();
//rstSave.updateLong(1,(long)last_id);
rstSave.updateLong(2,(long)3);
rstSave.updateString(3,"PROVA");
rstSave.updateString(4,"PROVA");
rstSave.updateString(5,"PROVA");
rstSave.updateBoolean(6,true);
rstSave.updateString(7,"PROVA");
rstSave.updateString(8,"PROVA");
rstSave.updateLong(9,(long)10);
rstSave.updateShort(10,(short)11);
rstSave.updateString(11,"PROVA");
rstSave.updateDouble(12,(double)12);
rstSave.updateDouble(13,(long)13);
rstSave.updateDouble(14,(long)14);
rstSave.insertRow();
rstSave.first();
}
id_lista++;
}
rst.close();
rstSave.close();

}catch (Exception e)
{
System.out.println("Connessione fallita");
e.printStackTrace();
}
}
}

0 new messages