Showing posts with label JDBC. Show all posts
Showing posts with label JDBC. Show all posts

Friday, October 10, 2008

Exception in JDBC Java client : "java.sql.SQLException: ORA-01410: invalid ROWID"

I was facing an issue with JDBC Java client which pulls the data from a function in Oracle Database. Whenever i try to get the value , i get exception saying
"java.sql.SQLException: ORA-01410: invalid ROWID",

Then did a small change in the JDBC java client, then was able to fix this issue.
The change that i made on the connection object is as below.
After getting the connection object using the driver manager i made the auto commit option as "False". By doing this i was able to get the value from the database with out any issue.

DriverManager.registerDriver(new OracleDriver());
//Establishing the connection
oracleConnection =
DriverManager.getConnection(thinConn, userName, password);
oracleConnection.setAutoCommit(false);

Monday, May 05, 2008

ORA-01000: maximum open cursors exceeded

Assum that you are looping through your result set.

If you get the "ORA-01000: maximum open cursors exceeded" error in java class, please check the following.

1. You should be having only one statemens object using connection(either statement, prepared statement or callable statement) and only one connection.

2. To make only single object for statements you can use the following check point before creating a new statements. It could be for any statements.
The below example is for prepared statement.
if(oPreparedStatement == null)
{
oPreparedStatement = oConn.getPreparedStatement(sPersonIdentifierQuery);
}

3. In your finally block don't forget to close the connection, statements and make them null. By following thies way you can get rid of the "ORA-01000: maximum open cursors exceeded exception".

4.The use of prepared statement is to compile the sql query and use it asmany time as you want, no need to prepare the statement again and again.