Explicit cast needed to convert java.* to to oracle.*

Hello,
I am trying to compile and run the following JSP but keep getting the "Incompatible type for = Explicit cast needed ..." error. The JSP and oracle procedure code are as follows:
<%@ page language="java" import="java.sql.*" %>
<%@ page import="oracle.jdbc.driver.*" %>
<HTML>
<HEAD>
<TITLE>
SimpleQuery JSP
</TITLE>
</HEAD>
<BODY BGCOLOR=EOFFFO>
<TABLE BORDER=1 BGCOLOR="C0C0C0">
<TH BGCOLOR="white"> <I>Node ID</I> </TH>
<%
     Connection con = null;
OracleCallableStatement cstmt= null;
     ResultSet rs = null;
try {
          String SYSTEM_DB_DRIVER =
"oracle.jdbc.driver.OracleDriver";
String SYSTEM_DB_URL =
"jdbc:oracle:thin:@myserver.com:1521:";
String SYSTEM_DB_FILE = "CONN_STRING";
String SYSTEM_DB_USER = "UNAME";
String SYSTEM_DB_PASSWORD = "PASSWD";
          Class.forName(SYSTEM_DB_DRIVER);
con = DriverManager.getConnection(SYSTEM_DB_URL +
SYSTEM_DB_FILE, SYSTEM_DB_USER, SYSTEM_DB_PASSWORD);
          cstmt = con.prepareCall("call eaicl_p_requirement.open_rule_dtl(?,?)");
          cstmt.registerOutParameter(1, OracleTypes.CURSOR);
<<I think I have to pass the p_product_id_in here but not sure how>>
          cstmt.execute();
          rs = ((OracleCallableStatement)cstmt).getCursor(1);
          while(rs.next())
          {%>
     <TR>
     <TD ALIGN=CENTER> <%= rs.getString(1) %> </TD>
     <TD ALIGN=CENTER> <%= rs.getInt(2) %> </TD>
</TR>
          <%}
               rs.close();
cstmt.close();
con.close();
catch(Exception e)
%>
</TABLE>
</BODY>
</HTML>
The Oracle PL/SQL package.procedure it is calling is:
     PROCEDURE open_rules_dtl (
          prc_rules_dtl_out          OUT     rc_fetch_rule_dtl,
          p_product_id_in          IN          NUMBER )
     IS
          vrc_rules_dtl               rc_fetch_rule_dtl;
     BEGIN
          OPEN vrc_rules_dtl FOR
               SELECT
                    r.rule_id,
                    r.rule_name,
                    r.rule_objective,
                    r.rule_description,
                    r.clearance_requirement,
                    r.rule_type
               FROM
                    eaicl_rule r
               WHERE
                    r.is_old = 'N' AND
                    r.product_id = CHR( p_product_id_in )
               ORDER BY
                    r.rule_name
          prc_rules_dtl_out := vrc_rules_dtl;
END open_rules_dtl;
I keep getting the following error on the webserver:
[05/Dec/2001:16:56:02] info ( 632): JSP: JSP1x compiler threw exception
org.apache.jasper.JasperException: Unable to compile class for JSPC:\iPlanet\Server4\https-wacc\config\..\ClassCache\_jsps\_ss_test5_jsp.java:84: Incompatible type for =. Explicit cast needed to convert java.sql.CallableStatement to oracle.jdbc.driver.OracleCallableStatement.
          cstmt = con.prepareCall("call eaicl_p_requirement.open_rule_dtl(?,?)");
          ^
I'm not sure how to fix it. I also need to pass the p_product_id parameter to the procedure.
Hope someone can point me in the right direction. Thanks.

Here's how you do an explicit cast:cstmt = (OracleCallableStatement)con.prepareCall("call eaicl_p_requirement.open_rule_dtl(?,?)");

Similar Messages

  • Convert java locale to Oracle NLS_TERITORY or NLS_COUNTRY?

    Hi, ist there any code around that would give me the Oracle NLS_TERITORY or NLS_COUNTRY for a given java.util.Locale, oracle.jbo.LocaleContext or a oracle.cabo.share.nls.LocaleContext?
    I like to do a ALTER SESSION SET NLS_COUNTRY and ALTER SESSION SET NLS_TERITORY in my ApplicationModule.prepareSession based on the JVMs locale setting (for our Swing / JClient) or the HttpSessions locale (for our UIX client).
    Thanks, Markus

    Ok, found a solution: use oracle.gss.util.NLSLocale coming with Oracle jdbcdriver. Sadly not mentioned in the JDBC API docs.
    From http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96529/ch9.htm#15488
    The JDBC Thin and JDBC OCI drivers make sure that Java stored procedures will be running in the same locale as that of the client Java VM.
    This sounds like the JDBC driver automatically performs a ALTER SESSION SET NLS_LANGUAGE and NLS_TERRITORY.
    I would be interested, what happens for 3 tier deployment or UIX applications, because normally there is a difference of the locale used for the application server and the one used at the client (JClient or browser session). The UIX runtime then should not only switch the locale for the application module, but also for the JDBC driver / oracle database. Would be curious if this happens.

  • Dropping java object from Oracle 8i

    We areaable to load java methods and publish them to SQL in Oracle 8i using Jdev Deploy wizard, but we can not drop them thru
    Open View As->Database Browser of the connection object, they drop menu is greyed out/disable. What kind privilege we need to drop java object from Oracle 8i? Or there is something wrong with the database setup.
    Thank you very much

    There are three options:
    Normal
    SysDBA
    SysOper
    I have tried the three of them, none of them works, is there third option SYS?
    Thank you very much.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Amit:
    Log in as SYS.<HR></BLOCKQUOTE>
    null

  • Converting Crystal reports to Oracle D2K reports or BI Publisher

    Hi I have one requirement
    I need to convert crystal reports to oracle D2k reports is there any tool which will make my work easier
    any body who has work on it please suggest.
    Thanks in advance
    Edited by: Qwerty on Jul 9, 2010 12:44 PM

    check this it may help
    http://www.oracle.com/technetwork/middleware/bi-publisher/convert-to-bi-publisher-11g-1611815.pdf ( page 25 - 45 )
    http://download.oracle.com/otndocs/xmlp/CrystaltoBIP.pdf

  • Need to convert an image to .jpeg using Java !

    Hello,
    i am working in images now. i need to convert any image in the form of .jpeg using Java. in other words, i need to store an image in the form of .jpeg format. can any of u help me ! thanks in advance.
    - Krishna

    There's also jimi, at http://java.sun.com/products/jimi/
    You can do something like:
    image = new BufferedImage (width, height, BufferedImage.TYPE_INT_RGB);
    // create your image
    String path = "/path/image.jpg";
    Jimi.putImage(image, path);
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Help! java novice, i need to convert boolean to char

    I have multiple checkboxes. Depending on what checkbox is selected, I need to convert that true boolean data to char data like 'L' or 'B'.
    If anyone can, please help. I would greatly appreciate it. Thanks.

    I'm not quite sure what you mean - boolean has only 2 states, true and false. A char can be any character. How about:
    if (someBooleanVar == true){
    someCharVar = "L";
    }else{
    someCharVar = "B";
    Again, I don't understand what you're doing, but it seems that you need to test the values of the checkboxes, and based on the values, you need to assign values to some char variables. Don't waste you're time trying to converts booleans to chars - it ain't gonna happen.

  • Need to convert JApplet to JFrame

    I need to write code for where I have 60 balls bouncing around inside a window. The client will then be able to select a button and it will pull out a ball with the number 1-60 written on it. The user will be able to do this up to 7 times. Each time it is done the past numbers that have already appeared can not reappear. What I am stuck on right now is geting my balls into a JFrame. Can anyone give advice or show how to. I currently have my 60 balls running in a JApplet. Here is the JAVA code and the HTML code. Thanks!
    Here is the JAVA code
    import java.awt.*;
    import java.applet.*;
    import java.util.*;
    import javax.swing.*;
    class CollideBall{
    int width, height;
    public static final int diameter=20;
    //coordinates and value of increment
    double x, y, xinc, yinc, coll_x, coll_y;
    boolean collide;
    Color color;
    Graphics g;
    Rectangle r;
    //the constructor
    public CollideBall(int w, int h, int x, int y, double xinc, double yinc, Color c){
    width=w;
    height=h;
    this.x=x;
    this.y=y;
    this.xinc=xinc;
    this.yinc=yinc;
    color=c;
    r=new Rectangle(150,80,130,90);
    public double getCenterX() {return x+diameter/2;}
    public double getCenterY() {return y+diameter/2;}
    public void alterRect(int x, int y, int w, int h){
    r.setLocation(x,y);
    r.setSize(w,h);
    public void move(){
    if (collide){  
    double xvect=coll_x-getCenterX();
    double yvect=coll_y-getCenterY();
    if((xinc>0 && xvect>0) || (xinc<0 && xvect<0))
    xinc=-xinc;
    if((yinc>0 && yvect>0) || (yinc<0 && yvect<0))
    yinc=-yinc;
    collide=false;
    x+=xinc;
    y+=yinc;
    //when the ball bumps against a boundary, it bounces off
    if(x<6 || x>width-diameter){
    xinc=-xinc;
    x+=xinc;
    if(y<6 || y>height-diameter){
    yinc=-yinc;
    y+=yinc;
    //cast ball coordinates to integers
    int x=(int)this.x;
    int y=(int)this.y;
    //bounce off the obstacle
    //left border
    if(x>r.x-diameter&&x<r.x-diameter+7&&xinc>0&&y>r.y-diameter&&y<r.y+r.height){
    xinc=-xinc;
    x+=xinc;
    //right border
    if(x<r.x+r.width&&x>r.x+r.width-7&&xinc<0&&y>r.y-diameter&&y<r.y+r.height){
    xinc=-xinc;
    x+=xinc;
    //upper border
    if(y>r.y-diameter&&y<r.y-diameter+7&&yinc>0&&x>r.x-diameter&&x<r.x+r.width){
    yinc=-yinc;
    y+=yinc;
    //bottom border
    if(y<r.y+r.height&&y>r.y+r.height-7&&yinc<0&&x>r.x-diameter&&x<r.x+r.width){
    yinc=-yinc;
    y+=yinc;
    public void hit(CollideBall b){
    if(!collide){
    coll_x=b.getCenterX();
    coll_y=b.getCenterY();
    collide=true;
    public void paint(Graphics gr){
    g=gr;
    g.setColor(color);
    //the coordinates in fillOval have to be int, so we cast
    //explicitly from double to int
    g.fillOval((int)x,(int)y,diameter,diameter);
    g.setColor(Color.white);
    g.drawArc((int)x,(int)y,diameter,diameter,45,180);
    g.setColor(Color.darkGray);
    g.drawArc((int)x,(int)y,diameter,diameter,225,180);
    public class BouncingBalls extends Applet implements Runnable {
    Thread runner;
    Image Buffer;
    Graphics gBuffer;
    CollideBall ball[];
    //Obstacle o;
    //how many balls?
    static final int MAX=60;
    boolean intro=true,drag,shiftW,shiftN,shiftE,shiftS;
    boolean shiftNW,shiftSW,shiftNE,shiftSE;
    int xtemp,ytemp,startx,starty;
    int west, north, east, south;
    public void init() {  
    Buffer=createImage(getSize().width,getSize().height);
    gBuffer=Buffer.getGraphics();
    ball=new CollideBall[MAX];
    int w=getSize().width-5;
    int h=getSize().height-5;
    //our balls have different start coordinates, increment values
    //(speed, direction) and colors
    for (int i = 0;i<60;i++){
    ball=new CollideBall(w,h,50+i,20+i,1.5,2.0,Color.white);
    /* ball[1]=new CollideBall(w,h,60,210,2.0,-3.0,Color.red);
    ball[2]=new CollideBall(w,h,15,70,-2.0,-2.5,Color.pink);
    ball[3]=new CollideBall(w,h,150,30,-2.7,-2.0,Color.cyan);
    ball[4]=new CollideBall(w,h,210,30,2.2,-3.5,Color.magenta);
    ball[5]=new CollideBall(w,h,360,170,2.2,-1.5,Color.yellow);
    ball[6]=new CollideBall(w,h,210,180,-1.2,-2.5,Color.blue);
    ball[7]=new CollideBall(w,h,330,30,-2.2,-1.8,Color.green);
    ball[8]=new CollideBall(w,h,180,220,-2.2,-1.8,Color.black);
    ball[9]=new CollideBall(w,h,330,130,-2.2,-1.8,Color.gray);
    ball[10]=new CollideBall(w,h,330,10,-2.1,-2.0,Color.gray);
    ball[11]=new CollideBall(w,h,220,230,-1.2,-1.8,Color.gray);
    ball[12]=new CollideBall(w,h,230,60,-2.3,-2.5,Color.gray);
    ball[13]=new CollideBall(w,h,320,230,-2.2,-1.8,Color.gray);
    ball[14]=new CollideBall(w,h,130,300,-2.7,-3.0,Color.gray);
    ball[15]=new CollideBall(w,h,210,90,-2.0,-1.8,Color.gray);*/
    public void start(){
    if (runner == null) {
    runner = new Thread (this);
    runner.start();
    /* public void stop(){
    if (runner != null) {
    runner.stop();
    runner = null;
    public void run(){
    while(true) {
    Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
    try {runner.sleep(15);}
    catch (Exception e) { }
    //move our balls around
    for(int i=0;i<MAX;i++)
    ball[i].move();
    handleCollision();
    repaint();
    boolean collide(CollideBall b1, CollideBall b2){
    double wx=b1.getCenterX()-b2.getCenterX();
    double wy=b1.getCenterY()-b2.getCenterY();
    //we calculate the distance between the centers two
    //colliding balls (theorem of Pythagoras)
    double distance=Math.sqrt(wx*wx+wy*wy);
    if(distance<b1.diameter)
    return true;
    return false;
    private void handleCollision()
    //we iterate through all the balls, checking for collision
    for(int i=0;i<MAX;i++)
    for(int j=0;j<MAX;j++)
    if(i!=j)
    if(collide(ball[i], ball[j]))
    ball[i].hit(ball[j]);
    ball[j].hit(ball[i]);
    public void update(Graphics g)
    paint(g);
    public void paint(Graphics g)
    gBuffer.setColor(Color.lightGray);
    gBuffer.fillRect(0,0,getSize().width,getSize().height);
    gBuffer.draw3DRect(5,5,getSize().width-10,getSize().height-10,false);
    //paint our balls
    for(int i=0;i<MAX;i++)
    ball[i].paint(gBuffer);
    g.drawImage (Buffer,0,0, this);
    Here is the HTML code
    <html>
    <body bgcolor="gray">
    <br><br>
    <div align="center">
    <applet code="BouncingBalls.class" width="1000" height="650"></applet>
    </div>
    </body>
    </html>

    In the future, Swing related questions should be posted in the Swing forum.
    First you need to convert your custom painting. This is done by overriding the paintComponent() method of JComponent or JPanel. Read the Swing tutorial on [Custom Painting|http://java.sun.com/docs/books/tutorial/uiswing/TOC.html].
    If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.
    Don't forget to use the [Code Formatting Tags|http://forum.java.sun.com/help.jspa?sec=formatting], so the posted code retains its original formatting.

  • Need to convert byte[] to image

    hi frnds,
    i have a byte[](which i got it from an image) i need to convert back to image.Could u pls suggest me how to??
    i tried with Pixelgrabber but i exaclty did get wht shld be the input for it(tried giving image file name). :(
    So pls let me know how and wht to use..ASAP.
    Regards
    subinjava

    Subinjava wrote:
    ..i have a byte[](which i got it from an image) i need to convert back to image.Could u pls suggest me how to??
    Image image = Toolkit.getDefaultToolkit().createImage(byteArray)See http://java.sun.com/javase/6/docs/api/java/awt/Toolkit.html#createImage(byte[]) for more details.

  • Need to convert a string to boolean

    i have string true, false, i need to convert them to boolean, is it good to use String.equals(true/false) or is it good to use Boolean.valueOf(true/false)
    Regards,
    Surya

    See http://forum.java.sun.com/thread.jsp?forum=54&thread=455788&tstart=0&trange=30.
    Remember, '=' is assignment, '==' is equals...

  • Need to convert a long into a string, please

    hi there
    i need to convert a long into a string. can i just cast it like this:
    (String)longNumber = some function that returns a long;

    Why not just use Long.toString()? If you start with a long value, you can create a Long object and get it's value as a String.

  • Need to convert a binary value into decimal

    Hi i need to convert a binary value which i would be getting as a string object to a decimal value......need code for the same

    Check Integer.parseInt
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Integer.html#parseInt(java.lang.String,%20int)

  • Need to convert lab from UNIX to DOS

    I need to convert this lab from Unix so that it will run as a batch file in Windows (substitute with the appropriate commands). (I will definitely be starting some UNIX classes soon).
    FILE=${1:?'Parameter 1 should be set to file name'}
    BLOCK=${2:?'Parameter 2 should be set to block to be corrupted''}
    BLOCKSIZE=${3:?Parameter 3 should be set to blocksize'}
    dd of=$FILE bs=$BLOCKSIZE conv=notrunc seek=$BLOCK <<EOF
    CORRUPT
    EOF
    dd of=$FILE bs=$BLOCKSIZE conv=notrunc seek='expr 1 + $BLOCK' <<EOF
    CORRUPT
    EOF
    dd of=$FILE bs=$BLOCKSIZE conv=notrunc seek='expr 2 + $BLOCK' <<EOF
    CORRUPT
    EOF
    dd of=$FILE bs=$BLOCKSIZE conv=notrunc seek='expr 3 + $BLOCK' <<EOF
    CORRUPT
    EOF

    Look up the SimpleDateFormat class: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
    Arwinder wrote:
    This is absolutely necessary... any help plz..For you maybe, not others. Please refrain from trying to urge others to answer your queries. They'll do it at their own pace ( if at all ).
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

  • Need to convert  Date from calendar to String in the format dd-mom-yyyy

    Need to convert Date from calendar to String in the format dd-mom-yyyy+..
    This is absolutely necessary... any help plz..
    Rgds
    Arwinder

    Look up the SimpleDateFormat class: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
    Arwinder wrote:
    This is absolutely necessary... any help plz..For you maybe, not others. Please refrain from trying to urge others to answer your queries. They'll do it at their own pace ( if at all ).
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

  • How can i convert java application of bibeans to java applet?

    Hi Bibeans PMTeam,
    Bibeans provide two type client:java application and web client(JSP/Servlet),because web client's function is weaker than java app,so we want to convert java app to java applet,thus,we can embed java applet into web browser(our system framework is in web browser).
    That is,we want one applet client that commution with a server side service(can by socket,just like oracle 9i form service)that provide the data that applet need,or the applet connect to olap server and bibeans catalog server by socket(this need security authentication if olap server,bibeans catalog,web server is not in one machine).
    so we need you provide whole resolve scheme,thanks a lot,if this answer is not clarity,please connect:[email protected],thanks a lot!

    hi tomsong
    well, in my experience 20mb are quite large for an applet. also take into account that you need a certain jvm that supports this type of application (my guess is that internet explorers native vm isnt an option)
    i personally would tend to deliver the functionality via java webstart (look at the sunsite):so you can centrally manage the software, download it once and opertae an application on your client (i mean an APPLICATION and not an applet)
    regarding 2: well but there is NO bibean service in ias: so you have to open the former mentioned jdbc connection to the olap service from your client
    for the availability: you have to check with the pm team
    in the meantime: what about the following approach: give power users a java application and lightweight or random users a handy html client ?
    regards,
    thomas

  • Converting Java class file to .dll

    Dear all,
    Is there any way to convert a Java class file to a .dll file?
    (Background being that there is a software that only allows callouts to DLLs and the method I have developed is in Java so need to convert it to a .dll)
    Any insight/advice/pointers are most appreciated.
    Thanks much,
    David

    Hi there,
    Yes you can convert a Java Class to DLL file using Microsoft Visual J#.NET (Installation required Visual Studio.NET) you can download it from the microsoft site.
    www.microsoft.com/downloads
    then go for search below in combo box(Visual J#.NET). After installation open new project select class library. write your java code(not fully supported j2se). build your application. All the Java Code is embeded in dll. Found at e.g. C:/JavaToDll/bin/debug/JavaToDll.dll This is a way to convert Java Code to a dll. frankly speaking i do not like .NET (copy of Java Technology must be baned completely).
    Thanks
    Please correct if i am wrong.
    Yahya Kamran (Software Engineer)

Maybe you are looking for