Subject | RES: [Firebird-Java] FBException (STILL HAVING PROBLEMS) |
---|---|
Author | Francisco Vieira |
Post date | 2003-10-04T09:44:28Z |
It seems to be in the setInt, I am not sure (I printed the lines just to
check and I just can see one line in the console), but I am sure now that is
something in Firebird regarding sending more than one action, the funny is
that before this block I have another one inserting a certain # of cities,
and it works properly, here is the code (but this one does not, would that
be something about my SMALLINT in the table?):
try
{
p = c.prepareCall("{call CAD_CIDADE_TARIFA(?, ?) }");
int tam = modeloCodigoSelecionado.size();
for(int i=0; i<tam; i++)
{
int codigo_tarifa = Integer.parseInt(textoCodigo.getText());
int codigo_cidade =
Integer.parseInt((String)modeloCodigoSelecionado.get(i));
p.setInt(1, codigo_cidade);
p.setInt(2, codigo_tarifa);
p.execute();
p.clearParameters();
}
T.getNew().Aviso(null, "CIDADES OK");
cidades = true;
} catch (Exception e2)
{
T.getNew().Aviso("Erro nas cidades", e2.toString());
}
/* Domain definitions */
CREATE DOMAIN DCOD AS INTEGER;
/* Table: CIDADETARIFADA, Owner: SYSDBA */
CREATE TABLE "CIDADETARIFADA"
(
"CODCIDADE" "DCOD" NOT NULL,
"CODTARIFA" "DCOD" NOT NULL,
PRIMARY KEY ("CODCIDADE")
);
-----Mensagem original-----
De: Robert DiFalco [mailto:rdifalco@...]
Enviada em: sexta-feira, 3 de outubro de 2003 17:35
Para: Firebird-Java@yahoogroups.com
Assunto: RE: [Firebird-Java] FBException (STILL HAVING PROBLEMS)
Which iteration of the loop fails and on what specific line? The #setInt?
The #setDouble?
-----Original Message-----
From: Francisco Vieira [mailto:franciscosouza2002@...]
Sent: Friday, October 03, 2003 1:16 PM
To: Firebird-Java@yahoogroups.com
Subject: [Firebird-Java] FBException (STILL HAVING PROBLEMS)
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
To unsubscribe from this group, send an email to:
Firebird-Java-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
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
check and I just can see one line in the console), but I am sure now that is
something in Firebird regarding sending more than one action, the funny is
that before this block I have another one inserting a certain # of cities,
and it works properly, here is the code (but this one does not, would that
be something about my SMALLINT in the table?):
try
{
p = c.prepareCall("{call CAD_CIDADE_TARIFA(?, ?) }");
int tam = modeloCodigoSelecionado.size();
for(int i=0; i<tam; i++)
{
int codigo_tarifa = Integer.parseInt(textoCodigo.getText());
int codigo_cidade =
Integer.parseInt((String)modeloCodigoSelecionado.get(i));
p.setInt(1, codigo_cidade);
p.setInt(2, codigo_tarifa);
p.execute();
p.clearParameters();
}
T.getNew().Aviso(null, "CIDADES OK");
cidades = true;
} catch (Exception e2)
{
T.getNew().Aviso("Erro nas cidades", e2.toString());
}
/* Domain definitions */
CREATE DOMAIN DCOD AS INTEGER;
/* Table: CIDADETARIFADA, Owner: SYSDBA */
CREATE TABLE "CIDADETARIFADA"
(
"CODCIDADE" "DCOD" NOT NULL,
"CODTARIFA" "DCOD" NOT NULL,
PRIMARY KEY ("CODCIDADE")
);
-----Mensagem original-----
De: Robert DiFalco [mailto:rdifalco@...]
Enviada em: sexta-feira, 3 de outubro de 2003 17:35
Para: Firebird-Java@yahoogroups.com
Assunto: RE: [Firebird-Java] FBException (STILL HAVING PROBLEMS)
Which iteration of the loop fails and on what specific line? The #setInt?
The #setDouble?
-----Original Message-----
From: Francisco Vieira [mailto:franciscosouza2002@...]
Sent: Friday, October 03, 2003 1:16 PM
To: Firebird-Java@yahoogroups.com
Subject: [Firebird-Java] FBException (STILL HAVING PROBLEMS)
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:
>This EXECPTION is driving me crazy, I have a Stored Procedure (in fact2 problems:
>I 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 theThe same problem: if you are trying to do this in a trigger - it must be
>system 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 allAs Ryan said, you have the wrong message file on the server, the client or
>the 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
To unsubscribe from this group, send an email to:
Firebird-Java-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
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