Subject | FBException (STILL HAVING PROBLEMS) |
---|---|
Author | Francisco Vieira |
Post date | 2003-10-03T20:15:48Z |
Look people, I am facing a problem that I have no idea how to solve it, once
I tried all the ways I could, I JUST WANT TO INSERT some values in a table
and commit in the end if everything is alright, I suspected something was
wrong with the reading in the JTable I have, so I decided to put the values
in some arrays just to be sure what was happening, HAVE A LOOK PLEASE, this
time I used PreparedStatement and I´ve got the same Exception message: null
null - FBSQLException GDS(something).
WHAT COULD BE WRONG WITH THIS? WHY THE LOOP IS EXECUTED JUST ONCE? HAVE YOU
EVER HAD SOMETHING LIKE THAT?
int numRows = modTabValores.getRowCount();
int array_codigos[] = new int[numRows];
int array_linhas[] = new int[numRows];
String array_tipos[] = new String[numRows];
double array_inicios[] = new double[numRows];
double array_finais[] = new double[numRows];
double array_valores[] = new double[numRows];
for(int i=0; i < numRows; i++)
{
array_codigos[i] = Integer.parseInt((String)tbValores.getValueAt(i,0));
array_linhas[i] =
Integer.parseInt((String)tbValores.getValueAt(i,1)); // (2)
array_tipos[i] =
((String)tbValores.getValueAt(i,2)).substring(0,1); // (3)
array_inicios[i] =
Double.parseDouble((String)tbValores.getValueAt(i,3)); // (4)
array_finais[i] =
Double.parseDouble((String)tbValores.getValueAt(i,4)); // (5)
array_valores[i] =
T.getNew().deMoedaParaDouble((String)tbValores.getValueAt(i,5)); // (6)
}
// ====== UNTIL HERE EVERYTHING IS OK
try
{
int tamanho = array_codigos.length;
PreparedStatement st = c.prepareStatement("INSERT INTO
VALORTARIFAS VALUES(?, ?, ?, ?, ?, ?) ");
for(int i=0; i<tamanho; i++)
{
st.setInt(1, array_codigos[i]);
st.setInt(2, array_linhas[i]);
st.setString(3, array_tipos[i]);
st.setDouble(4, array_inicios[i]);
st.setDouble(5, array_finais[i]);
st.setDouble(6, array_valores[i]);
st.execute();
st.clearParameters();
}
}
catch (Exception e3)
{
T.getNew().Aviso("Erro nos VALORES", e3.toString());
}
The metadata for the table used is:
/* Domain definitions */
CREATE DOMAIN DCOD AS INTEGER;
CREATE DOMAIN DVALOR AS NUMERIC(12, 2)
DEFAULT 0;
/* Table: VALORTARIFAS, Owner: SYSDBA */
CREATE TABLE "VALORTARIFAS"
(
"CODTABELA" "DCOD" DEFAULT 0,
"NUMLINHA" SMALLINT DEFAULT 0,
"TIPOTARIFA" CHAR(1) DEFAULT ' ',
"QUANTINICIO" NUMERIC(8, 3),
"QUANTFINAL" NUMERIC(8, 3),
"VALORFAIXA" "DVALOR" DEFAULT 0
);
====================================================== END OF MY MESSAGE
-----Mensagem original-----
De: Helen Borrie [mailto:helebor@...]
Enviada em: sexta-feira, 3 de outubro de 2003 10:20
Para: Firebird-Java@yahoogroups.com
Assunto: Re: [Firebird-Java] HELP HELP HELP - FBException
PLEASE DON'T SEND MESSAGES IN HTML!!
At 08:52 AM 3/10/2003 -0300, you wrote:
1. if you have a column to be inserted by a trigger, you must OMIT it from
your INSERT statement.
2. An AFTER INSERT trigger won't work. Any new.value for an insert or
update but be in a BEFORE INSERT trigger. Use AI triggers for inserting
values into OTHER tables.
omitted from the INSERT statement and the trigger must be BEFORE
INSERT. But if you are sending CURRENT_DATE in your SQL, then that's fine,
no problem.
both.
Helen
Yahoo! Groups Sponsor
ADVERTISEMENT
To unsubscribe from this group, send an email to:
Firebird-Java-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.521 / Virus Database: 319 - Release Date: 23/09/2003
I tried all the ways I could, I JUST WANT TO INSERT some values in a table
and commit in the end if everything is alright, I suspected something was
wrong with the reading in the JTable I have, so I decided to put the values
in some arrays just to be sure what was happening, HAVE A LOOK PLEASE, this
time I used PreparedStatement and I´ve got the same Exception message: null
null - FBSQLException GDS(something).
WHAT COULD BE WRONG WITH THIS? WHY THE LOOP IS EXECUTED JUST ONCE? HAVE YOU
EVER HAD SOMETHING LIKE THAT?
int numRows = modTabValores.getRowCount();
int array_codigos[] = new int[numRows];
int array_linhas[] = new int[numRows];
String array_tipos[] = new String[numRows];
double array_inicios[] = new double[numRows];
double array_finais[] = new double[numRows];
double array_valores[] = new double[numRows];
for(int i=0; i < numRows; i++)
{
array_codigos[i] = Integer.parseInt((String)tbValores.getValueAt(i,0));
array_linhas[i] =
Integer.parseInt((String)tbValores.getValueAt(i,1)); // (2)
array_tipos[i] =
((String)tbValores.getValueAt(i,2)).substring(0,1); // (3)
array_inicios[i] =
Double.parseDouble((String)tbValores.getValueAt(i,3)); // (4)
array_finais[i] =
Double.parseDouble((String)tbValores.getValueAt(i,4)); // (5)
array_valores[i] =
T.getNew().deMoedaParaDouble((String)tbValores.getValueAt(i,5)); // (6)
}
// ====== UNTIL HERE EVERYTHING IS OK
try
{
int tamanho = array_codigos.length;
PreparedStatement st = c.prepareStatement("INSERT INTO
VALORTARIFAS VALUES(?, ?, ?, ?, ?, ?) ");
for(int i=0; i<tamanho; i++)
{
st.setInt(1, array_codigos[i]);
st.setInt(2, array_linhas[i]);
st.setString(3, array_tipos[i]);
st.setDouble(4, array_inicios[i]);
st.setDouble(5, array_finais[i]);
st.setDouble(6, array_valores[i]);
st.execute();
st.clearParameters();
}
}
catch (Exception e3)
{
T.getNew().Aviso("Erro nos VALORES", e3.toString());
}
The metadata for the table used is:
/* Domain definitions */
CREATE DOMAIN DCOD AS INTEGER;
CREATE DOMAIN DVALOR AS NUMERIC(12, 2)
DEFAULT 0;
/* Table: VALORTARIFAS, Owner: SYSDBA */
CREATE TABLE "VALORTARIFAS"
(
"CODTABELA" "DCOD" DEFAULT 0,
"NUMLINHA" SMALLINT DEFAULT 0,
"TIPOTARIFA" CHAR(1) DEFAULT ' ',
"QUANTINICIO" NUMERIC(8, 3),
"QUANTFINAL" NUMERIC(8, 3),
"VALORFAIXA" "DVALOR" DEFAULT 0
);
====================================================== END OF MY MESSAGE
-----Mensagem original-----
De: Helen Borrie [mailto:helebor@...]
Enviada em: sexta-feira, 3 de outubro de 2003 10:20
Para: Firebird-Java@yahoogroups.com
Assunto: Re: [Firebird-Java] HELP HELP HELP - FBException
PLEASE DON'T SEND MESSAGES IN HTML!!
At 08:52 AM 3/10/2003 -0300, you wrote:
>This EXECPTION is driving me crazy, I have a Stored Procedure (in fact I2 problems:
>have 3 for the same operation, but I am using try and catch to check each
>one) with 30 arguments to INSERT in a table wich has 3 NOT NULL fields,
>one (the code) is INSERTED by a generator value incremented in the TRIGGER
>(AFTER INSERT TRIGGER),
1. if you have a column to be inserted by a trigger, you must OMIT it from
your INSERT statement.
2. An AFTER INSERT trigger won't work. Any new.value for an insert or
update but be in a BEFORE INSERT trigger. Use AI triggers for inserting
values into OTHER tables.
>the name is ALWAYS typed and the last, the date, is taken from the systemThe same problem: if you are trying to do this in a trigger - it must be
>date,
omitted from the INSERT statement and the trigger must be BEFORE
INSERT. But if you are sending CURRENT_DATE in your SQL, then that's fine,
no problem.
>but I've got this exception message everytime (even when I fill in all theAs Ryan said, you have the wrong message file on the server, the client or
>fields in the form):
>
>org.firebirdsql.jdbc.FBSQLException: GDS Exception
>No message for code 335544347 found.
>null
>null
both.
Helen
Yahoo! Groups Sponsor
ADVERTISEMENT
To unsubscribe from this group, send an email to:
Firebird-Java-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.521 / Virus Database: 319 - Release Date: 23/09/2003