String query = "SELECT some_fields FROM some_table WHERE id = ?";
Prepared Statement ps = conn.prepareStatement(query);
ps.setString(1, id.toString());
ps.executeQuery(); // this throws the folowing exception
java.sql.SQLException: Zamkni?ta instrukcja
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:274)
at oracle.jdbc.driver.OracleStatement.ensureOpen(OracleStatement.java:49
35)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar
edStatement.java:382)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePrepare
dStatement.java:339)
at org.jboss.pool.jdbc.PreparedStatementInPool.executeQuery(PreparedStat
ementInPool.java:71)
The connection is ok. The statement is not closed or anything. The syntax of the
syntax of the query is ok, because i tested it on the Oracle console. What is
strange, is that this exception is thrown only some times. What I mean is that
regardles of the id parameter, the execution of this query some times throws
an excpetion, and some times not, without any special patern.
I will be gratefull for all help
MIchal
--
GG : #2814355
e-mail : mailto:snoo...@wp.pl
fotoWWW : http://foto.natolin.net
bikeWWW : http://rowery.natolin.net (under construction)
-Nathan
Michal Rutkowski <mr18...@zodiac.mimuw.eduXXX.pl> wrote in message news:<slrnbk1avi....@zodiac.mimuw.edu.pl>...
Well I think this is not the case either. I log all of these queries, and
checked them (cut & paste) on the console, they where ok. Also we checked the
alternative version :
ps.setLong(1, id); // now there can't be anything messing my query
but this didn't eliminate my problem.
michal
So, the query are correct on Oracle console and the error is random, I
suggest to check this:
1. try a simple java program, that send the statements by jdbc driver:
sometimes the drivers don't translate exactly your statement: I think on SQL
Server with statements LIKE 'B*' and LIKE 'B%'...
2. verify if it is the problem of multiple access and table lock (I don't
think so but, anyway...)
I hope this help...
Giuseppe
PS: tell me what was the problem! ;-) I'm interested about it, because I'll
must develope a new application based on Oracle JDBC dirver...