• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Oracle JDBC Missing IN or OUT parameters

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Rácz György
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is my full code:



Many thanks in advance.
 
Shailesh Chandra
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shailesh!

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

I say thank you for the help!

George
 
Rácz György
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DJ Java Decopiler create more readable result:
Test:



Production

 
Rácz György
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If i not use -dis parameter, then Jad create readable output too.
(Jad UserStorage.class)
 
Shailesh Chandra
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic