Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

(Un)common error with Oracle?

 
Andrew Sweeney
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all,
I'm attempting to call an SP from Oracle 8.1.7.1 from a simple JDBC call. On all packages save one, this works just dandy. On the problem package, I am returned the following:
Exception in thread "main" java.lang.NullPointerException
at oracle.jdbc.ttc7.TTCAdapter.newTTCType(TTCAdapter.java) at oracle.jdbc.ttc7.TTCAdapter.createNonPlsqlTTCColumnArray(TTCAdapter.java)
...
I'll omit the rest for brevity, but this seems to be a common occurrence on the Oracle forums, yet I haven't seen a useful solution on those boards. Has anyone run into this in their Oracle dealings? (And for interest, I'll post the JAva code below)
JAVA CODE----------------------------------------
public OraTest() {
try {
Connection conn = initializeConnection();
conn.setAutoCommit( false );
String call = "? = { call FP_PKG_WEB.CHECK_WFS_CONTRACT_DATES(?,?) }";
CallableStatement cs1 = conn.prepareCall( call );
cs1.registerOutParameter( 1, OracleTypes.NUMBER );
cs1.setInt( 2, 2283847 );
cs1.setString( 3, "10-Feb-2002" );
cs1.execute();

int result = cs1.getInt(1);
System.out.println("RESULT: " + result );
}
catch( SQLException sql ) {
sql.printStackTrace();
}
}

private Connection initializeConnection() throws SQLException {
Connection masterConn = null;

String db = "DEV";
String dbIP = "IPAddress"; //dev ip and port.
if (db.equalsIgnoreCase("PROD"))
{
dbIP = "IPAddress"; //prod ip and port.
}
try
{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
masterConn = DriverManager.getConnection("jdbc racle:thin:@"+dbIP+":" + db , user, pass);
}
catch(SQLException ex ) {
masterConn = null;
ex.printStackTrace();
}
return masterConn;
}
END JAVA CODE------------------------------------
[ February 12, 2002: Message edited by: Andrew Sweeney ]
 
Sonal Jogi
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Remove all the spaces before the callable statement and yur problem would be solved. I had a similar problem with the following statement:
String greaterAreaQuery = " {CALL ? := MTG_GREATER_CITIES_FUNC(?)}";
when i removed the space between " and CALL, it was solved. Hope the same works for you also.

regards,
sonal
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!