File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes how do i get this boolean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how do i get this boolean" Watch "how do i get this boolean" New topic
Author

how do i get this boolean

manish basotia
Ranch Hand

Joined: Jan 12, 2004
Posts: 47
I have a stored function which takes two string parameter and return a boolean value (true/false).
Now using jdbc how do i get this boolean value. Below is my code.


package mypackage4;

import java.sql.*;
import java.io.*;

public class hi{

public static void main(String ss[]){
Connection conn = null;
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection ( " jdbc racle:thin:@192.168.1.204:1525:ganga5","ccls","ccls");
//Man -begin

//Man begin - added for checking the obselete property of TPHShape
System.out.println("Before calling procedure");
// conn.setAutoCommit(false);
CallableStatement callstmt = conn.prepareCall("{? = call IS_TPH_OBSOLETE(?,?)}");
System.out.println("procedure called with conn "+conn+" and callstmt "+callstmt);
callstmt.registerOutParameter(1,Types.BIT);
System.out.println("Checking bit");
callstmt.setString( 2, "ABCD1" );
callstmt.setString( 3, "ENG" );
System.out.println(" called ...");
callstmt.execute()
System.out.println("********* In my code value received is ***");
boolean bh = callstmt.getBoolean(1);
System.out.println("********* In my code value received is ***");
}catch(Exception er){
System.out.println("Error here only");
er.printStackTrace();
}

}
}

its giveing error at "callstmt.execute()"
Stating
java.sql.SQLException: ORA-06550: line 1, column 13:
PLS-00382: expression is of wrong type
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored


void oracle.jdbc.dbaccess.DBError.throwSqlException(java.lang.String, java.lang.String, int)

void oracle.jdbc.ttc7.TTIoer.processError()

void oracle.jdbc.ttc7.Oall7.receive()

void oracle.jdbc.ttc7.TTC7Protocol.doOall7(byte, byte, int, byte[], oracle.jdbc.dbaccess.DBType[], oracle.jdbc.dbaccess.DBData[], int, oracle.jdbc.dbaccess.DBType[], oracle.jdbc.dbaccess.DBData[], int)

int oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(oracle.jdbc.dbaccess.DBStatement, byte, byte[], oracle.jdbc.dbaccess.DBDataSet, int, oracle.jdbc.dbaccess.DBDataSet, int)

void oracle.jdbc.driver.OracleStatement.executeNonQuery(boolean)

void oracle.jdbc.driver.OracleStatement.doExecuteOther(boolean)

void oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout()

int oracle.jdbc.driver.OraclePreparedStatement.executeUpdate()

void mypackage4.hi.main(java.lang.String[])
Please help its very urgent
[ May 13, 2004: Message edited by: Bear Bibeault ]
SJ Adnams
Ranch Hand

Joined: Sep 28, 2001
Posts: 925
maybe post the source of the pl/sql function.
Marshall B Thompson
Ranch Hand

Joined: Apr 11, 2002
Posts: 42
From the Oracle9i JDBC Developer's Guide and Reference: "the JDBC drivers do not support the passing of BOOLEAN parameters to PL/SQL stored procedures."
It is talking about passing to a stored procedure, and you are returning a BOOLEAN from your stored procedure, however; maybe the BOOLEAN is the issue.
Marshall B Thompson
Ranch Hand

Joined: Apr 11, 2002
Posts: 42
Funny how things tie together sometimes. I just ran across some doc that says that return values of BOOLEAN from PL/SQL are not supported by JDBC>
 
Consider Paul's rocket mass heater.
 
subject: how do i get this boolean
 
Similar Threads
calling a procedure with an Oracle package
Loadjava and user_objects table
CallableStatement resultset returns only columns and no data, where data exists.
Problem calling IN parameters Stored Procedure from Java
Call an Oracle package