Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic