Calling OCX Methods from a Java Program

Hi All,
Is it possible to call OCX methods from a Java program? If yes, can you please refer me to any documents or sample code to achieve this.
All inputs are highly appreciated.
Thanks
Tarek

JNI
http://java.sun.com/docs/books/tutorial/native1.1/index.html

Similar Messages

  • Possibility of calling standard actions from a java program

    Hi ,
    I am working for a project where customer wants to have option of saving orders as draft only and later convert to order if need be. However since we do not want many drafts to reside on server there is a need to delete these at a specified time. For draft orders I am using order templates since they stay in the database without getting converted to orders. Now I do not know how to go about the deletion part.
    i need to write a program that would run on the server and which would fetch the templates (drafts) that have been created till a particular time and call the delete action of the template. Now the question is how do i call these actions from a java program where this java program will have to run on the server end (ie will be a backend process).
    Please suggest.
    Thanks
    Roopali

    hello roopali,
    you can create a separate thread that will run your
    code that will check for stale drafts and delete them.
    it is just like a session management program but here
    we will be looking over the drafts and not the session
    objects.
    now if you want the invocation of the action from another
    program, a socket program would suffice but opening ports
    will cause you network connections thru firewall.
    if you can make use of HTTP servlet as your service
    provider e.g., you can then just pass some action params
    to invoke it.
    regards
    jo

  • Calling another application from a java program

    Hi, Java ppl.
    I wanted to know how can I call another program say a help application or an exe from a java program. anyone with any advice or a piece of code would help.
    Thanks
    Pradeep

    I had the same situation and I tried the code that you sugested and it works. I was wondering, what am I expecting in the while loop that appears after the int inp; statement? Is some data going to be displayed on the screen? How essential is to have that while loop after the calling the exec() method?
    Sorry for the amount of questions, I never tried this before.
    Best regards,
    Luis E.

  • How to call the method from the java bean and pass it to JSP textbox

    i'm quite new to java thats why i'm asking how to call a method in the java bean file and pass it to the JSP textbox. My projects are communicating JSP with C#. i had successfully created a C# client bean file for JSP. The whole process is to type something on the server(C# programming) and it would appear in the textbox.

    your question doesn't provide much informartion. provide some other information and coding so that we could tell exactly what you are looking for?

  • Calling a servlet from a java program

    I could not find a forum for servlet hence am posting
    here
    I have a servlet that accepts prameters and
    gives some out put .
    I want to be able to call this servlet ( invoke )
    from a Java Program .
    How do i do that ..
    Any sample code /pointer would be appreciated.
    Deepa

    hi
    you can try this code.
    URL url = new URL("http://localhost:8888/yourServlet?param1=value1");
    URLConnection con = url.openConnection();
    StringBuffer sBuf = new StringBuffer();
    BufferedReader bReader = new BufferedReader(
    new InputStreamReader(
    con.getInputStream()));
    String line = null;
    while((line = bReader.readLine()) != null) {
    sBuf.append(line);
    System.out.println(sBuf);
    hope this helps
    Shrini

  • Calling jsp page from a java program

    Hello,
    Is it possible to call a JSP page from a java program? If so, please let me know how it is possible.
    I have a JSP page that inserts 10 records in a database based on the attribute given to the page. When the java program is executed all the 10 records need to be inserted.
    The JSP page is already running fine in Tomcat.
    Thanks and Regards,
    Prasanna.

    MVC has applied the standard of seperate your view , model and controller. I believe nobody will insert data from jsp page,better practice should be inserted from your database layer, normally is like DAO layer. so you should pass your data from jsp to your backend.
    hopefully it's help u

  • Calling an executable from a java program

    How can I call a compiled program from a java program. I have a fortran program, which I would like to call for execution from within my java program. My OS is linux.
    Thanks,
    An

    Not quite sure in the case of fortran program, but one thing can be done, call ur fortran program from a batch (.bat file) and call this .bat file from java ;
    try {
    Process p = Runtime.getRuntime().exec("run.bat");
    p.waitFor();
    catch( Exception e ) {
    }

  • Call ODI Scenario from a Java Program

    Hi,
    I would like to invoke the ODI Scenario from a Java Program. Is there any way i can do this?
    Please let me know if you have any posts related to this.
    Thanks,
    Mansur

    Check this ..
    How to run ODI scenario from java?

  • Calling another class from a java program

    I tried to call the Server1.class from the password program, but I failed. The password program source code is as follows:
    class PasswordDialog extends java.awt.Dialog implements java.awt.event.ActionListener
         * Constructor. Create this visual dialog component.
         public PasswordDialog(java.awt.Frame parent, PasswordVerifier verifier)
              super(parent);
              addWindowListener(new WindowEventHandler());
              setLayout(new java.awt.FlowLayout());
              setSize(500, 100);
              this.verifier = verifier;
              add(useridField = new java.awt.TextField(10));
              add(passwordField = new java.awt.TextField(10));
              add(okButton = new java.awt.Button("Submit"));
              add(cancelButton = new java.awt.Button("Cancel"));
              okButton.addActionListener(this);
              cancelButton.addActionListener(this);
              passwordField.setEchoChar('*');
              useridField.requestFocus();
         public void actionPerformed(java.awt.event.ActionEvent e)
              if (e.getSource() == okButton)
                   // Invoke password verification callback
                   try
                        boolean result = verifier.verifyPassword(
                             useridField.getText(), passwordField.getText());
                        if (! result) return;     // verification failed; don't close this dialog
                   catch (Exception ex)
                        ex.printStackTrace();
                   // Close this dialog
                   System.out.println("I still can't call the Server1 class");
                   dispose();
              else if (e.getSource() == cancelButton)
                   dispose();
         class WindowEventHandler extends java.awt.event.WindowAdapter
              public void windowClosing(java.awt.event.WindowEvent e)
                   System.exit(0);
         // Private objects
         private PasswordVerifier verifier;
         private java.awt.TextField useridField;
         private java.awt.TextField passwordField;
         private java.awt.Button okButton;
         private java.awt.Button cancelButton;
    interface PasswordVerifier
         public boolean verifyPassword(String userid, String password) throws Exception;
    public class password implements PasswordVerifier
         * Main routine for testing only.
         public static void main(String[] args)
              password verifier = new password();
              java.awt.Frame f = new java.awt.Frame("Password Verifier");
              f.setSize(100, 100);
              f.show();
              PasswordDialog d = new PasswordDialog(f, verifier);
              d.show();
         public boolean verifyPassword(String userid, String password) throws Exception
              return (userid.equals("Albert") && password.equals("Einstein"));
    and the Server1.java is as follows:
    //Server Application
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    public class Server1 extends Frame implements ActionListener,Runnable,KeyListener
    ServerSocket s;
    Socket s1;
    BufferedReader br;
    BufferedWriter bw;
    TextField text;
    TextField name;
    Button exit,clear;
    Label label;
    List list;
    Panel p1=null;
    Panel p2=null;
    Panel sp21=null;
    Panel sp22=null;
    Panel jp=null;
    public void run()
              try{s1.setSoTimeout(1);}catch(Exception e){}
              while (true)
                   try{
    list.add(br.readLine());
                   }catch (Exception h){}
    if(list.getItemCount()==7)
    list.remove(0);
    public Server1(String m)
    {       super(m);
    jp=new Panel();
    p1=new Panel();
    p2=new Panel();
    sp21=new Panel();
    sp22=new Panel();
    jp.setLayout(new GridLayout(2,1));
    p1.setLayout(new GridLayout(1,1));
    p2.setLayout(new GridLayout(2,1));
    sp21.setLayout(new FlowLayout());
    sp22.setLayout(new FlowLayout());
    exit = new Button("Exit");
    clear = new Button("Clear");
    exit.addActionListener(this);
    clear.addActionListener(this);
    list = new List(50);
    text = new TextField(43);
    name = new TextField(10);
    label = new Label("Enter your name");
    name.addKeyListener(this);
    text.addKeyListener(this);
    p1.add(list);
    sp21.add(text);
    sp21.add(exit);
    sp22.add(label);
    sp22.add(name);
    sp22.add(clear);
    p2.add(sp21);
    p2.add(sp22);
    jp.add(p1);
    jp.add(p2);
    this.add(jp);
    setBackground(Color.orange);
    setSize(380,300);
    setLocation(0,0);
    setVisible(true);
    setResizable(false);
    name.requestFocus();
    try{
    s = new ServerSocket(786);
                   s1=s.accept();
                   br = new BufferedReader(new InputStreamReader(
                             s1.getInputStream()));
                   bw = new BufferedWriter(new OutputStreamWriter(
                             s1.getOutputStream()));
    bw.write("Welcome");bw.newLine();bw.flush();
                   Thread th;
                   th = new Thread(this);
                   th.start();
              }catch(Exception e){}
    public static void main(String args[])
    new Server1("Server");
         public void actionPerformed ( ActionEvent e)
    if (e.getSource().equals(exit))
                   System.exit(0);
    else if (e.getSource().equals(clear))
    { name.setText(" ");
    name.setEditable(true);
    public void keyPressed(KeyEvent ke) {
    if(text.equals(ke.getSource()))
    if(ke.getKeyCode()==KeyEvent.VK_ENTER)
    try{
    bw.write(name.getText()+">>"+text.getText());
                   bw.newLine();bw.flush();
                   }catch(Exception m){}
    list.add(name.getText()+">>"+text.getText());
    text.setText("");
    else if(name.equals(ke.getSource())) {
    if(ke.getKeyCode()==KeyEvent.VK_ENTER)
    name.setEditable(false);
    text.requestFocus();
    public void keyReleased(KeyEvent ke)
    //something
    public void keyTyped(KeyEvent ke)
    //something
    I tried to create a new object by typing:
    Server1 s = new Server1();
    then call the main function
    new Server1("Server");
    but it doesn't work. Anybody can help me with this?

    try
    Server1 s = new Server1();
    s.Server1("Server");
    or
    new Server1().Server1("Server");

  • Calling a method from another Java file.

    I think I'm doing this right, but I'm obviously going wrong somewhere.
    In order to not have one big long java file, I've created one main one to execute the program, and another to do some of the functions. I'm using eclipse, btw.
    In the main file, I have
    currentTB = getActiveTB(playerArea);If it works, it should get send the player area variable to the getActiveTB method, and store the value it returns in the currentTB variable, right?
    In the other file, I have;
    package scenes;
    public class sceneIndex {
         private TerrainBlock getActiveTB(String areaCode) {
              TerrainBlock tBlock = new TerrainBlock();
                     **DOES STUFF**
              return tBlock;
    }I have it set up so the second file is in the source folder "resources" and the package "scenes." The problem is I'm not calling it properly. I'm missing something simple, I think. The only error I'm getting is;
    The method getActiveTB(String) is undefined...
    Where am I screwing up?
    EDIT: Yeah, I'm a rookie here trying to figure it out on my own. My computer science courses, so far, conveniently all consist of just one big java file. Easier to write, sure, but not very efficient/organized.
    Message was edited by:
    SuckerPunch

    Yeah, so this is still pissing me off. I'm not sure what else to do. I've tried this a million different ways, in both eclipse and netbeans. Whatever. Here's the code, I'd love it if someone could point out the boneheaded mistake I'm making. I'm getting a little frustrated at being stuck on such a simple problem.
    Main.javaimport com.jme.app.BaseGame;
    import com.jme.input.KeyBindingManager;
    import com.jme.input.KeyInput;
    import com.jme.math.Vector3f;
    import com.jme.renderer.Camera;
    import com.jme.renderer.ColorRGBA;
    import com.jme.scene.Node;
    import com.jme.system.DisplaySystem;
    import com.jme.system.JmeException;
    import com.jme.util.Timer;
    import com.jmex.terrain.TerrainBlock;
    import resources.*;
    public class Main extends BaseGame {
         /* General Variable Declaration */
         private String scene;   // Tells application which scene to load, default loads default scene
         private int width, height, depth, freq; // Creates variables to store information
         private boolean fullscreen;             // on the user's window
         private Camera playerCam; // Defines the main camera for the player, first person view
         private Timer timer; // Creates a timer to be used for FPS calculations
         private Node currentScene; // The basis for building the scene the player is in
         private TerrainBlock currentTB; // This variable holds the current landscape
         private String playerArea = new String("initial"); // Contains the string
                                                                        // code for the scene
                                                                        // the player is in,
                                                                        // defaults to the opening scene, unless changed by
                                                                        // the player loading their game
            public static void main(String[] args) {
              /* Initializes and Starts the Applications. */
              Main app = new Main();
              app.setDialogBehaviour(ALWAYS_SHOW_PROPS_DIALOG, Main.class.getClassLoader().getResource("img/spunch.jpg"));
              app.start();
         protected void update(float interpolation) {
         protected void render(float interpolation) {
         protected void initSystem() {
               * Application initialization properties (window, camera, renderer, key
               * bindings, etc)
              // Stores variables for window properties
              width = properties.getWidth();
              height = properties.getHeight();
              depth = properties.getDepth();
              freq = properties.getFreq();
              fullscreen = properties.getFullscreen();
              // Assigns renderer and creates game window
              try {
                   display = DisplaySystem.getDisplaySystem(properties.getRenderer());
                   display.createWindow(width, height, depth, freq, fullscreen);
                   playerCam = display.getRenderer().createCamera(width, height);
              } catch (JmeException e) {
                   e.printStackTrace();
                   System.exit(1);
              // Sets background to black, should never be seen anyway
              display.getRenderer().setBackgroundColor(ColorRGBA.black);
              // Initializes the camera
              playerCam.setFrustumPerspective(45.0f, (float) width / (float) height,
                        1, 1000);
              Vector3f loc = new Vector3f(250.0f, 100.0f, 250.0f);
              Vector3f left = new Vector3f(-0.5f, 0.0f, 0.5f);
              Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
              Vector3f dir = new Vector3f(-0.5f, 0.0f, -0.5f);
              // Moves and orients the camera
              playerCam.setFrame(loc, left, up, dir);
              // Update the camera since it has been changed
              playerCam.update();
              // Create a timer for FPS updates
              timer = Timer.getTimer();
              // Assign the camera as the primary display in the application
              display.getRenderer().setCamera(playerCam);
              // Initialize the escape key as a way to exit the program
              KeyBindingManager.getKeyBindingManager().set("exit",
                        KeyInput.KEY_ESCAPE);
         protected void initGame() {
              /* Game initialization */
              display.setTitle("Slumlords"); // Displays title in window
                    SceneIndex sIndex = new SceneIndex();
              currentTB = sIndex.getActiveTB(playerArea);
              currentScene.attachChild(currentTB);
              currentScene.updateGeometricState(0.0f, true);
              currentScene.updateRenderState();
         protected void reinit() {
         protected void cleanup() {
    }SceneIndex.javapackage resources;
    import javax.swing.ImageIcon;
    import com.jme.bounding.BoundingBox;
    import com.jme.image.Texture;
    import com.jme.math.Vector3f;
    import com.jme.scene.state.TextureState;
    import com.jme.system.DisplaySystem;
    import com.jme.util.TextureManager;
    import com.jmex.terrain.TerrainBlock;
    import com.jmex.terrain.util.MidPointHeightMap;
    import com.jmex.terrain.util.ProceduralTextureGenerator;
    public class SceneIndex {
         private DisplaySystem display;
         public TerrainBlock getActiveTB(String areaCode) {
              TerrainBlock tBlock = new TerrainBlock();
              if (areaCode == "initial") {
                   // Generates random terrain data
                   MidPointHeightMap heightMap = new MidPointHeightMap (64, 1.0f);
                   // Scale the data
                   Vector3f terrainScale = new Vector3f(4, 0.0575f, 4);
                   // Create the terrain block
                   tBlock = new TerrainBlock("Terrain", heightMap.getSize(), terrainScale, heightMap.getHeightMap(), new Vector3f(0, 0, 0), false);
                   tBlock.setModelBound(new BoundingBox());
                   tBlock.updateModelBound();
                   // Creating a blended texture based on the height map
                   ProceduralTextureGenerator pTexture = new ProceduralTextureGenerator(heightMap);
                   pTexture.addTexture(new ImageIcon(SceneIndex.class.getClassLoader().getResource("img/grass.gif")), -128, 0, 128);
                   pTexture.addTexture(new ImageIcon(SceneIndex.class.getClassLoader().getResource("img/dirt.jpg")), 0, 128, 255);
                   pTexture.addTexture(new ImageIcon(SceneIndex.class.getClassLoader().getResource("img/granite.jpg")), 128, 255, 384);
                   pTexture.createTexture(64);
                   // Assigning the texture to the terrain
                   TextureState tState = display.getRenderer().createTextureState();
                   Texture t1 = TextureManager.loadTexture(pTexture.getImageIcon().getImage(), Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR, true);
                   tState.setTexture(t1, 0);
                   tBlock.setRenderState(tState);
              return tBlock;
    }Again, I've tried this a few different ways, and I either get a "Could Not Find Symbol" error referring to the getActiveTB(playerArea); in Main, or it just says java.lang.NoClassDefFoundError: and Exception in thread "main".
    Whatever.

  • How to expose and call AM methods from plain java (testability etc)?

    Hello,
    my project is just starting out with the OA Framework. We just encountered our first hurdle - I hope someone here can help out or at least point me in the right direction. None of this stuff seems to be explicitly mentioned in the standard OAF documentation.
    This is the situation: We need to call the logic in our Application Modules directly. Two reasons for this:
    - We need to expose methods in the AM as web services
    - We really want to create unit\integration tests (probably JUnit) and set up some sort of continous integration environment (Cruisecontrol or similar).
    Now, how do we go about this? I see that controller code usually does something a la this:
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    This doesn't seem viable for plain javacode, since there is no pageContext or web beans in that situation.
    Now, I allready tried the most naive approach (tried it in the OAF Tutorial):
    EmployeeAMImpl employeeAMImpl = new EmployeeAMImpl();
    This of course doesn't work, since none of the VO\EO seem to be instantiated, db connection is probably not set up etc.
    The third approach is the one I found in the javadoc for OAApplicationModuleImpl:
    // load some basic properties
    Properties properties = loadProperties();
    javax.naming.Context ic = new InitialContext(properties);
    // 'defName' is the JNDI name for the application module
    // definition from which the root Application Module is to be created
    String defName = "abc.xyz.SampleApplicationModule";
    oracle.jbo.ApplicationModuleHome home = ic.lookup(defName);
    return home.create();
    This seems more promising this far, however I need help with the following two questions:
    1: Do I really need to go through JNDI to access my AMs from plain javacode (JUnit tests, webservices etc)? If not, how do I then instantiate AMs, complete with EOs, VOs etc?
    2: If I do need to go through JNDI: what is the easiest way to register and subsequently call my AMs and their logic\context, particularly for usage from web services and testing frameworks (JUnit etc)?
    I'm kinda stumped here, guys. How have you solved this, if you haven't then how would you go about doing it?

    Hello,
    my project is just starting out with the OA Framework. We just encountered our first hurdle - I hope someone here can help out or at least point me in the right direction. None of this stuff seems to be explicitly mentioned in the standard OAF documentation.
    This is the situation: We need to call the logic in our Application Modules directly. Two reasons for this:
    - We need to expose methods in the AM as web services
    - We really want to create unit\integration tests (probably JUnit) and set up some sort of continous integration environment (Cruisecontrol or similar).
    Now, how do we go about this? I see that controller code usually does something a la this:
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    This doesn't seem viable for plain javacode, since there is no pageContext or web beans in that situation.
    Now, I allready tried the most naive approach (tried it in the OAF Tutorial):
    EmployeeAMImpl employeeAMImpl = new EmployeeAMImpl();
    This of course doesn't work, since none of the VO\EO seem to be instantiated, db connection is probably not set up etc.
    The third approach is the one I found in the javadoc for OAApplicationModuleImpl:
    // load some basic properties
    Properties properties = loadProperties();
    javax.naming.Context ic = new InitialContext(properties);
    // 'defName' is the JNDI name for the application module
    // definition from which the root Application Module is to be created
    String defName = "abc.xyz.SampleApplicationModule";
    oracle.jbo.ApplicationModuleHome home = ic.lookup(defName);
    return home.create();
    This seems more promising this far, however I need help with the following two questions:
    1: Do I really need to go through JNDI to access my AMs from plain javacode (JUnit tests, webservices etc)? If not, how do I then instantiate AMs, complete with EOs, VOs etc?
    2: If I do need to go through JNDI: what is the easiest way to register and subsequently call my AMs and their logic\context, particularly for usage from web services and testing frameworks (JUnit etc)?
    I'm kinda stumped here, guys. How have you solved this, if you haven't then how would you go about doing it?

  • Calling servlet from a java program

    Hi
    I need to call a servlet's doPost() method from a java program. I have a specific situation, where I need to call servlet from a java program. DUring this call I need to pass a file and two string to the servlet. Servelt after receiving the file and string uploads the file to the server at a specified location. I am stuck up as how to call servlet from a java program instead of a HTML or JSP.
    Can anyone help me to start with this.
    any suggestion is welcome.

    You have to establish a URLConnection with servlet from your java program.
    URL servletURL = new URL("http://localhost:8080/Myservlet?str1=abc&str2=def");
    URLConnection servletConnection = servletURL.openConnection();you can get the objectOutputStream
    ObjectOutputStream oos = new ObjectOutputStream (servletConnection.getOutputStream());
    oos.writeObject(your file object);-------------------------------------------------
    In the servlet u can get the strings using request.getParameter("str1");
    In the servlet u can get the strings using request.getParameter("str2");
    file = new ObjectInputStream (request.getInputStream()).readObject()a lot of resources are available on this ...
    hope this helps :)

  • How to return a object from a method in a java program to a C++ call (JNI )

    Sir,
    I am new to java and i have been assigned a task to be done using JNI.
    My question is,
    How can i return an object from a method in a java program to a call for the same method in a C++program using JNI.
    Any help or suggesstions in this regard would be very useful.
    Thanking you,
    Anjan Kumar

    Hello
    I would like to suggest that JNI should be your last choice and not your first choice. JNI is hard to get right. Since the JNI code is executing in the same address space as the JVM, any problems (on either side) will take down the entire process. It dilutes the Write Once Run Anywhere (WORA) value proposition because you need to provide the JNI component for all hardware/OS platforms. If you can keep your legacy code(or whatever you feel you need to do in JNI) in a separate address space and communicate via some inter-process channel, you end up with a system that is more flexible, portable, and scalable.
    Having said all that, head over to the Java Native Interface: Programmer's Guide and Specification web page:
    http://java.sun.com/docs/books/jni/
    Scroll down to the Download the example code in this book in ZIP or tar.gz formats. links and download the example source. Study and run the example sources. The jniexamples/chap5/MyNewString demo creates a java.lang.String object in native code and returns it to the Java Language program.

  • Calling C++ method from Java program on Linux

    I'm trying to get set up to call a C++ method from a Java app on a SUSE Linux box. I follow the steps of the "Hello World" baby example in Beth Stearns's tutorial, "Integrating Native Code and Java Programs", but I get the following error message:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: /users/dmizell/testIF/libhello.so: /users/dmizell/testIF/libhello.so: invalid ELF header (Possible cause: endianness mismatch)
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1028)
    at HelloWorld.<clinit>(HW.java:7)
    at Main.main(Main.java:5)
    Any idea what I might be doing wrong?
    thanks
    David

    Your library is compiled in a way which is incompatible with the VM you are using.
    Note that there is a JNI forum.

  • Cannot call ANY stored functions from my Java program

    My problem is that I cannot call ANY stored procedure from my Java
    program. Here is the code for one of my stored procedures which runs
    very well in PL/SQL:
    PL/SQL code:
    CREATE OR REPLACE PACKAGE types AS
    TYPE cursorType IS REF CURSOR;
    END;
    CREATE OR REPLACE FUNCTION list_recs (id IN NUMBER)
    RETURN types.cursorType IS tracks_cursor types.cursorType;
    BEGIN
    OPEN tracks_cursor FOR
    SELECT * FROM accounts1
    WHERE id = row_number;
    RETURN tracks_cursor;
    END;
    variable c refcursor
    exec :c := list_recs(11)
    SQL> print c
    COLUMN1 A1 ROW_NUMBER
    rec_11 jacob 11
    rec_12 jacob 11
    rec_13 jacob 11
    rec_14 jacob 11
    rec_15 jacob 11
    Here is my Java code:
    import java.sql.*;
    import java.io.*;
    import oracle.jdbc.driver.*;
    class list_recs
    public static void main(String args[]) throws SQLException,
    IOException
    String query;
    CallableStatement cstmt = null;
    ResultSet cursor;
    // input parameters for the stored function
    String user_name = "jacob";
    // user name and password
    String user = "jnikom";
    String pass = "jnikom";
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    try { Class.forName ("oracle.jdbc.driver.OracleDriver"); }
    catch (ClassNotFoundException e)
    { System.out.println("Could not load driver"); }
    Connection conn =
    DriverManager.getConnection (
    "jdbc:oracle:thin:@10.52.0.25:1521:bosdev",user,pass);
    try
    String sql = "{ ? = call list_recs(?) }";
    cstmt = conn.prepareCall(sql);
    // Use OracleTypes.CURSOR as the OUT parameter type
    cstmt.registerOutParameter(1, OracleTypes.CURSOR);
    String id = "11";
    cstmt.setInt(2, Integer.parseInt(id));
    // Execute the function and get the return object from the call
    cstmt.executeQuery();
    ResultSet rset = (ResultSet) cstmt.getObject(1);
    while (rset.next())
    System.out.print(rset.getString(1) + " ");
    System.out.print(rset.getString(2) + " ");
    System.out.println(rset.getString(3) + " ");
    catch (SQLException e)
    System.out.println("Could not call stored function");
    e.printStackTrace();
    return;
    finally
    cstmt.close();
    conn.close();
    System.out.println("Stored function was called");
    Here is how I run it, using Win2K and Oracle9 on Solaris:
    C:\Jacob\Work\Java\Test\Vaultus\Oracle9i\FunctionReturnsResultset>java
    list_recs
    Could not call stored function
    java.sql.SQLException: ORA-00600: internal error code, arguments:
    [ttcgcshnd-1], [0], [], [], [], [], [], []
    at
    oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
    at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java:889)
    at
    oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:490)
    at
    oracle.jdbc.driver.OracleStatement.getCursorValue(OracleStatement.java:2661)
    at
    oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:4189)
    at
    oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:4123)
    at
    oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:541)
    at list_recs.main(list_recs.java:42)
    C:\Jacob\Work\Java\Test\Vaultus\Oracle9i\FunctionReturnsResultset>
    Any help is greatly appreciated,
    Jacob Nikom

    Thank you for your suggestion.
    I tried it, but got the same result. I think the difference in the syntax is due to the Oracle versus SQL92 standard
    conformance. Your statament is the Oracle version and mine is the SQL92. I think both statements are acceptable
    by the Oracle.
    Regards,
    Jacob Nikom

Maybe you are looking for