Olá !
Ao tentar fazer uma atualização de uma linha em uma tabela, recebo uma mensagem de erro. Abaixo seguem um trecho do código que escrevi e a mensagem. Agradeço a ajuda que puderem me oferecer.
CÓDIGO
static final String JDBC_DRIVER = "org.firebirdsql.jdbc.FBDriver";
public static void main(String[] args)
{
Connection conn = null;
Statement stm = null;
int linhas;
try
{
Class.forName( JDBC_DRIVER );
conn = DriverManager.getConnection("jdbc:firebirdsql:localhost/3050:G:/bancos/aih/fb/BDAIH.fdb", "SYSDBA", "masterkey" );
stm = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet consulta = stm.executeQuery(
"SELECT AIH From AIH");
consulta.absolute(1);
try
{
consulta.updateString("APRES,"0105");
consulta.updateRow();
}
catch ( SQLException sqlException )
{
sqlException.printStackTrace();
System.exit( 1 );
}
}
catch ( SQLException sqlException )
{
sqlException.printStackTrace();
System.exit( 1 );
}
catch ( ClassNotFoundException classNotFound )
{
classNotFound.printStackTrace();
System.exit( 1 );
}
finally
{
try
{
conn.close();
}
catch ( Exception exception )
{
exception.printStackTrace();
System.exit( 1 );
}
}
}
MENSAGEM DE ERRRO
org.firebirdsql.jdbc.FBResultSetNotUpdatableException: Underlying result set does not contain all columns that form 'best row identifier'.
at org.firebirdsql.jdbc.FBRowUpdater.getParameterMask(FBRowUpdater.java:198)
at org.firebirdsql.jdbc.FBRowUpdater.executeStatement(FBRowUpdater.java:431)
at org.firebirdsql.jdbc.FBRowUpdater.updateRow(FBRowUpdater.java:340)
at org.firebirdsql.jdbc.FBResultSet.updateRow(FBResultSet.java:2493)
[size=“11”][color=“red”]* Editado: Lembre-se de utilizar BBCode em seus códigos - AnjoSupremo[/color][/size] :joia: