jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases 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 and Relational Databases
Bookmark "how do i get this boolean" Watch "how do i get this boolean" New topic

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;
conn = DriverManager.getConnection ( " jdbc racle:thin:@","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);
System.out.println("Checking bit");
callstmt.setString( 2, "ABCD1" );
callstmt.setString( 3, "ENG" );
System.out.println(" called ...");
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");


its giveing error at "callstmt.execute()"
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>
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: how do i get this boolean
jQuery in Action, 3rd edition