Analista de Sistemas |
Cleverson Sacramento |
2006-01-23 00:00:00 |
When I try to execute the following query on Microsoft Access, just 1 row is returned. But when I try to execute on HXTT JDBC Access Driver, no row is returned!!!
select *
from Funcionarios f
where f.CodigoFuncionario = ?
and f.CodigoEmpresa = ?
When I delete the last line, 1 row is returned:
select *
from Funcionarios f
where f.CodigoFuncionario = ?
I tried exhaustingly execute the query wihout PreparedStatement setting the parameters manually, but the problem persists.
select *
from Funcionarios f
where f.CodigoFuncionario = 3309061
and f.CodigoEmpresa = 33
The original code is the following:
/**
* Prepara o solicitante para a emissão de um Boletim de Ocorrencia.
* @param solicitante Solicitante do BO.
* @throws br.com.netra.j2fw.exception.NetraException Exceção padrão.
*/
public void preparaSolicitante(Funcionario solicitante)
throws NetraException {
try {
StringBuffer sb = new StringBuffer();
sb.append(" select * ");
sb.append(" from Funcionarios f ");
sb.append(" where f.CodigoFuncionario = ? ");
sb.append(" and f.CodigoEmpresa = ? ");
Connection conn = this.getConnection();
PreparedStatement st = conn.prepareStatement(sb.toString());
int i = 1;
DBParser.set(st, i++, new Long(solicitante.getMatricula()));
DBParser.set(st, i++, ConstanteDAO.RBTEMPO_COD_EMPRESA);
ResultSet rs = st.executeQuery();
if (!rs.next()) {
rs.close();
st.close();
conn.close();
throw new ValidacaoException(ConstanteDAO.MENSAGEM_VALIDACAO_NENHUM_REGISTRO);
}
rs.close();
st.close();
conn.close();
} catch (Throwable cause) {
this.trataExcecao(cause);
}
}
I am having problems in Production Environment. How to decide the problem? The previous driver version presents problem the same? I am using version Access JDBC 3.0 Package 2006-01-18 07:52.
|
Re: No rows returned |
Cleverson Sacramento |
2006-01-24 00:00:00 |
I get a new Access JDBC 3.0 Package, revision 2006-01-23 11:36, but a problem continues.
My access version is 97. The definition of columns is: CodigoFuncionario double; CodigoEmpresa long integer. The PreparedStatement parameters are java.lang.Long and java.lang.Long respectively. Already I also tried java.lang.Double and java.lang.Long respectively, but the problem continues.
My string conection is the following:
jdbc:access:/t:/db/rbtempo.mdb
Necessary of aid urgently.
|
Re:Re:Analista de Sistemas |
HXTT Support |
2006-01-24 00:00:00 |
>My access version is 97. The definition of columns is: CodigoFuncionario double; CodigoEmpresa long integer.
You should have index on CodigoEmpresa column, but HXTT Access failed to use index to find that row because your index should have some corrupted information. You can try Repair and Compact once your rbtempo.mdb in MS Access, then HXTT Access should work normally again for your application.
|
Re:Re:Re: No rows returned |
Cleverson Sacramento |
2006-01-24 00:00:00 |
I repaired and compacted my rbtempo.mdb, but the problem persists. The problem occurs when i use both restrictions simultaneously, in other words its no index problem.
I converted the rbtempo.mdb for 2000 version, then it gave successfull.
|
Re:Re:Re:Re:Analista de Sistemas |
HXTT Support |
2006-01-24 00:00:00 |
It should be an index issue. If possible, you can email webmaster@hxtt.com that Access 97 rbtempo.mdb .
|
Re:Re:Re:Re:Re: No rows returned |
Cleverson Sacramento |
2006-01-24 00:00:00 |
I sent the rbtempo.mdb to webmaster@hxtt.com. I wait a reply anxiously!
|
Re:Re:Re:Re:Re:Re:Analista de Sistemas |
HXTT Support |
2006-01-24 00:00:00 |
Thanks for your sample. Found MS Access 97 has used compression index sometimes. Supported. Please download the latest package.
|
Re:Re:Re:Re:Re:Re:Re: ArrayIndexOutOfBoundsException |
Cleverson Sacramento |
2006-01-24 00:00:00 |
Now the SELECT works, but the UPDATE throws a ArrayIndexOutOfBoundsException.
Follows the code-source:
/**
* Justifica a falta do funcion������rio atualizando o sistema RB-TEMPO.
* @param dto Recebe o dto para atualizar a base do RB-TEMPO ap������s ter sido
* executado o m������todo preparaApontamento.
* @return
* @throws br.com.netra.j2fw.exception.NetraException
*/
public Serializable criar(AbstractDTO dto) throws NetraException {
try {
BoletimOcorrencia bo = (BoletimOcorrencia) dto;
StringBuffer sb = new StringBuffer();
sb.append(" update apontamento set ");
sb.append(" justificativa = ?, ");
sb.append(" obs = ? ");
sb.append(" where codigofuncionario = ? ");
sb.append(" and codigoempresa = ? ");
sb.append(" and dataapontamento = ? ");
Iterator iter = bo.getApontamentos().iterator();
while (iter.hasNext()) {
BoletimOcorrenciaApontamento apontamento = (BoletimOcorrenciaApontamento) iter.next();
Connection conn = this.getConnection();
PreparedStatement st = conn.prepareStatement(sb.toString());
int i = 1;
DBParser.set(st, i++, bo.getJustificativa().getCodigo());
DBParser.set(st, i++, bo.getJustificativa().getDescricao());
DBParser.set(st, i++,
new Long(bo.getSolicitante().getMatricula()));
DBParser.set(st, i++, ConstanteDAO.RBTEMPO_COD_EMPRESA);
DBParser.set(st, i++, apontamento.getHorario().getData());
if (st.executeUpdate() == 0) {
throw new ValidacaoException(ConstanteDAO.MENSAGEM_VALIDACAO_NENHUM_REGISTRO);
}
st.close();
conn.close();
}
} catch (Throwable cause) {
cause.printStackTrace();
this.trataExcecao(cause);
}
return null;
}
Follows the exception:
06/01/24 14:59:05 java.sql.SQLException: java.lang.ArrayIndexOutOfBoundsException
06/01/24 14:59:05 at com.hxtt.global.SQLState.SQLException(Unknown Source)
06/01/24 14:59:05 at com.hxtt.sql.a7.a(Unknown Source)
06/01/24 14:59:05 at com.hxtt.sql.y.a(Unknown Source)
06/01/24 14:59:05 at com.hxtt.sql.cm.char(Unknown Source)
06/01/24 14:59:05 at com.hxtt.sql.cm.executeUpdate(Unknown Source)
06/01/24 14:59:05 at com.evermind.sql.FilterPreparedStatement.executeUpdate(FilterPreparedStatement.java:240)
06/01/24 14:59:05 at com.evermind.sql.FilterPreparedStatement.executeUpdate(FilterPreparedStatement.java:240)
06/01/24 14:59:05 at com.evermind.sql.FilterPreparedStatement.executeUpdate(FilterPreparedStatement.java:240)
06/01/24 14:59:05 at br.gov.ba.bahiatursa.wf.dao.BoletimOcorrenciaDAO.criar(BoletimOcorrenciaDAO.java:279)
The expression works when I execute directly on Microsoft Access:
update apontamento set
justificativa = 'AE'
obs = 'ABONO ENTRADA'
where codigofuncionario = 3309061
and codigoempresa = 33
and dataapontamento = #01/16/2006#
Execute this to see the modified data:
select * from apontamento
where codigofuncionario = 3309061
and codigoempresa = 33
and dataapontamento = #01/16/2006#
Execute this to return to original values:
update apontamento set
justificativa = null,
obs = null
where codigofuncionario = 3309061
and codigoempresa = 33
and dataapontamento = #01/16/2006#
And now?
|
Re:Re:Re:Re:Re:Re:Re:Re:Analista de Sistemas |
HXTT Support |
2006-01-24 00:00:00 |
Recurred and supported. Now the compression index format of MS Access 97 has been supported fully. Please download the latest package.
>#01/16/2006#
In sql, you should use '2006-01-16', '2006/01/16', or {d '2006-01-16'}.
|
Re:Re:Re:Re:Re:Re:Re:Re:Analista de Sistemas |
Cleverson Sacramento |
2006-01-25 00:00:00 |
Now its okay. Thanks.
|