aspose file tools*
The moose likes JDBC and the fly likes Oracle JDBC Missing IN or OUT parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Oracle JDBC Missing IN or OUT parameters" Watch "Oracle JDBC Missing IN or OUT parameters" New topic
Author

Oracle JDBC Missing IN or OUT parameters

Rácz György
Greenhorn

Joined: Nov 12, 2008
Posts: 19
Hi Java Gurus!

Sorry for my bad english!

I use this java code

stmt = connection.prepareStatement("SELECT * FROM USRD WHERE USID=?");
stmt.setInt(1, userId.intValue());

I everywhere (localhost, production server, test server) use Tomcat 6 and JDK 6 and Oracle 10g.When Tomcat 6 server start 1 reseived this exception:

2008-11-07 09:41:56,215 [Thread-24] ERROR com.gfth.cemidms.download.server.DownloadLimitReset :: sql exception occured, try rollback
java.sql.SQLException: Hi�nyz� IN vagy OUT param�ter a k�vetkezo indexn�l:: 1
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:190)
at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1769)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3464)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3514)
at com.gfth.cemidms.storage.UserStorage.getUser(UserStorage.java:719)
at com.gfth.cemidms.storage.DownloadLimitStorage.resetAll(DownloadLimitStorage.java:98)
at com.gfth.cemidms.download.server.DownloadLimitReset.execute(DownloadLimitReset.java:20)
at com.gfth.cemidms.storage.StorageHelper.executeTransaction(StorageHelper.java:102)
at com.gfth.cemidms.storage.StorageHelper.execute(StorageHelper.java:70)
at com.gfth.cemidms.download.server.DownloadLimitReset.run(DownloadLimitReset.java:25)
at com.gfth.cemidms.download.server.DownloadLimitResetScheduler.run(DownloadLimitResetScheduler.java:59)

This error only occured the production server, my pc (localhost) everything is ok. I use ojdbc14_g.jar (1.4.2_08). The test and a production server is x64bit architecture, my pc is only 32bit.

If I use the comment stmt.setInt() line, then i received this exception on localhost too.

I found 2 site the same problem

http://forums.bea.com/thread.jspa?threadID=600015631
http://forums.sun.com/thread.jspa?forumID=48&threadID=720264

I don't understand why occured this error only the production server. The stms is PreparedStatement, and this is fine works other place in my code.Can anybody found this problem?

I found Oracle Drivers:

http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_10201.html

I use this driver version: Oracle Database 10g Release 2 (10.2.0.3) JDBC Drivers
ojdbc14_g.jar (1,938,906 bytes) - same as ojdbc14.jar, except that classes were compiled with "javac -g" and contain some tracing information. I'm use this.

I found the driver last version: Oracle Database 10g Release 2 (10.2.0.4) JDBC Drivers
ojdbc14_g.jar (1,950,033 bytes) - same as ojdbc14.jar, except that classes were compiled with "javac -g" and contain some tracing information.

The "Missing IN or OUT paramteres" exception possibe driver problem?

Many thanks in advance.

George
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

Hi R�cz,

Welcome to Javaranch.

Can you post complete code, We are not able know how are you executing your query. Also I would advise that put your code inside [ CODE ] tag.

Shailesh


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Rácz György
Greenhorn

Joined: Nov 12, 2008
Posts: 19
Here is my full code:



Many thanks in advance.
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

I do not see any problem in your code, is there a possibility that production server has different class file.

Shailesh
Rácz György
Greenhorn

Joined: Nov 12, 2008
Posts: 19
Hi!

I use MyEclipse 6.5, and create the production and a test .war. The 2 server has a different properties,(path etc) but the .java files is same. The 2 war files size is not equal.

The production war size is 8,300,883 MBs the test war file size is 7,732,697 MBs.

All functions is correct only this one is bad, and this is only when Apache server start.

Thanks!
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

only thing i would suggest is compare the size of UserStorage.class at both places, they should have same size

Shailesh
Rácz György
Greenhorn

Joined: Nov 12, 2008
Posts: 19
Hi!

I compare the war files in Total Commander. All class files size is different...Example UserStorage.class size in production war 49,967Kbs and the test war file 35,854 Kbs.

I don't understand why different classes and war files. Have you got a tip?

Thanks
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

there can be various reasons, I do not think it is same war which is deployed on your local and production environment.

Just to find the cause of problem, just copy the UserStorage.class on local machine and decompile is using jad. you can download jad from http://www.kpdus.com/jad.html#download .

Then you can see the source code, it your source code is not same as you posted here, then you know where is the problem, otherwise we will have to further investigate the problem.

Shailesh
Rácz György
Greenhorn

Joined: Nov 12, 2008
Posts: 19
Hi Shailesh!

Ok! I download the program and decompile .class files.

I say thank you for the help!

George
Rácz György
Greenhorn

Joined: Nov 12, 2008
Posts: 19
Hi Shailesh!

I decompiled local and production UserStoage.class files. Here is the result:
I used this command: jad -dis UserStorage.class

Test UserStorage.class:

production:

Every methods different on parameter names.
Rácz György
Greenhorn

Joined: Nov 12, 2008
Posts: 19
DJ Java Decopiler create more readable result:
Test:



Production

Rácz György
Greenhorn

Joined: Nov 12, 2008
Posts: 19
If i not use -dis parameter, then Jad create readable output too.
(Jad UserStorage.class)
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

The code for method in both places, production appears to be right, but one thing is sure that they are not compiled from same source. as method's parameter names are different. Also when I see code generated by dj compiler it has a different method name as getUserLight however earlier method name was getUser

Do you have some other class with same name ?

Either move your running code to production or put some debug statement in the code on which production server is running to ensure that it is using same class.

Shailesh
Rácz György
Greenhorn

Joined: Nov 12, 2008
Posts: 19
Sorry!

I'm was very tired when put this code...the UserStorage has a many user set and get methods. This is the correct code:

Test



Prod



Sorry...
Rácz György
Greenhorn

Joined: Nov 12, 2008
Posts: 19
This is the prod. server UserStoage.class decompiled code:

public User getUser(Integer integer, Connection connection)
throws SQLException
{
PreparedStatement preparedstatement;
ResultSet resultset;
preparedstatement = null;
resultset = null;
User user;
preparedstatement = connection.prepareStatement("SELECT * FROM USRD WHERE USID=?");
preparedstatement.setInt(1, integer.intValue());
resultset = preparedstatement.executeQuery();
if(resultset.next())
{
user = getUserFromResultSet(resultset);
addOffice(user, connection);
addProjects(user, connection);
addPositions(user, connection);
addVacations(user, connection);
} else
{
user = null;
}
if(null != resultset)
try
{
resultset.close();
}
catch(SQLException sqlexception)
{
logger.fatal(sqlexception);
}
if(null != preparedstatement)
try
{
preparedstatement.close();
}
catch(SQLException sqlexception1)
{
logger.fatal(sqlexception1);
}
break MISSING_BLOCK_LABEL_196;
Exception exception;
exception;
if(null != resultset)
try
{
resultset.close();
}
catch(SQLException sqlexception2)
{
logger.fatal(sqlexception2);
}
if(null != preparedstatement)
try
{
preparedstatement.close();
}
catch(SQLException sqlexception3)
{
logger.fatal(sqlexception3);
}
throw exception;
return user;
}

This is a UserStorage source code:

public User getUser(Integer userId, Connection connection) throws SQLException{
User user = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
stmt = connection.prepareStatement("SELECT * FROM USRD WHERE USID=?");
stmt.setInt(1, userId.intValue());

rs = stmt.executeQuery();
if (rs.next()) {
user = getUserFromResultSet(rs);
addOffice(user, connection);
addProjects(user, connection);
addPositions(user, connection);
addVacations(user, connection);
} else {
user = null;
}

} finally {
if (null != rs) {
try {
rs.close();
} catch (SQLException e) {
logger.fatal(e);
}
}
if (null != stmt) {
try {
stmt.close();
} catch (SQLException e) {
logger.fatal(e);
}
}
}

return user;
}

Can anybody help me?
 
wood burning stoves
 
subject: Oracle JDBC Missing IN or OUT parameters