SQLJ -Context

This seems a very simple example, but it does not work. I want
to specify a context with a SQLJ-statement. It keeps telling
me "Missing equal sign in assignment" at line 23 (#sql
(testContext) { drop table test };).
Can anyone tell me what is wrong?? To me it al seems ok.
Thanks!
import java.sql.*;
import sqlj.runtime.ref.*;
#sql context NewContext;
public class MyClass{
public static void main (String args[]) throws SQLException{
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
catch (Exception e){
System.out.println("driver not loaded");
NewContext testContext = new NewContext( "jdbc:oracle:thin:@
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(COMMUNITY=TCP.world)
(PROTOCOL=TCP)(Host=atlantis)(Port=1521)))(CONNECT_DATA=
(SID=AT)))"
, "acht114", "vh_cu
rsus", true);
#sql (testContext) { drop table test };
testContext.close();
null

Thanx, it works.
It's weird though, in all the books and articles I have it is
done with normal brackets ().
Now I can go on, great!!
Mohan E (guest) wrote:
: context should be placed in rectangular braces, like:
: #sql [testContext] { drop table test };
: All the best
: Mohan E
: Els (guest) wrote:
: : This seems a very simple example, but it does not work. I
want
: : to specify a context with a SQLJ-statement. It keeps telling
: : me "Missing equal sign in assignment" at line 23 (#sql
: : (testContext) { drop table test };).
: : Can anyone tell me what is wrong?? To me it al seems ok.
: : Thanks!
: : import java.sql.*;
: : import sqlj.runtime.ref.*;
: : #sql context NewContext;
: : public class MyClass{
: : public static void main (String args[]) throws SQLException{
: : try{
: : Class.forName("oracle.jdbc.driver.OracleDriver");
: : catch (Exception e){
: : System.out.println("driver not loaded");
: : NewContext testContext = new NewContext( "jdbc:oracle:thin:@
: : (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(COMMUNITY=TCP.world)
: : (PROTOCOL=TCP)(Host=atlantis)(Port=1521)))(CONNECT_DATA=
: : (SID=AT)))"
: : , "acht114",
: "vh_cu
: : rsus", true);
: : #sql (testContext) { drop table test };
: : testContext.close();
null

Similar Messages

  • [SQLJ] Context Problem

    Hi all,
    I am working on Oracle 9i and I compile with the Oracle Console Entreprise Manager.
    From an instance baseA, I am looking for getting values from other instance baseB :
    Code :
    DefaultContext connB = Oracle.getConnection("jdbc:oracle:thin:@ipServer:1521:baseB","user","pwd");
    DefaultContext connA = Oracle.getConnection("jdbc:oracle:thin:@ipServer:1521:baseA","user","pwd");
    try {
         String result = "";
         #sql [[connB ]] { SELECT lib INTO :result FROM TAB_MESURE WHERE id = 4 };
         RETURN result;
    finally {
         connB.close();
         connA.close();
    When compiling, this error is displayed
    Warning: Impossible de vérifier la clause WHERE. Erreur renvoyée par la base de données : ORA-00942: Table ou vue inexistante (french)
    ORA-00942: Table or view doest not exist
    - all tns are corectly set up
    - Within the same instance,all requests are OK (without using of context)
    - I tried diferent connection method wothout success (Oracle.connect, DefaultContext.setDefaultContext, )
    Thanks for your help
    Merci pour votre aide
    Edited by: user11166064 on 14 mai 2009 02:41
    Edited by: user11166064 on 14 mai 2009 02:49

    Ok,
    So i re-formulate my request, here the acual code executed :
    h5. 1- Java code :
    import java.sql.*;
    import sqlj.runtime.ref.DefaultContext;
    import oracle.sqlj.runtime.Oracle;
    import sqlj.runtime.ExecutionContext;
    #sql iterator MyIter2 (Integer elt_id, String elt_lst_code, String elt_lib, Integer elt_actif);
    public class TestInsert {
    public static void test() throws Exception {
              DefaultContext connB = Oracle.getConnection("jdbc:oracle:thin:@ipServer:1521:baseB","user","pwd");
              DefaultContext connA = Oracle.getConnection("jdbc:oracle:thin:@ipServer:1521:baseA","user","pwd");
              MyIter2 iter;
              Integer ident;
              String listCode;
              String lib;
              String actif;
              try {
                   #sql [[connB]] iter={ select elt_id, elt_lst_code, elt_lib, elt_actif from baseB.<user>.ELT elt_elt_id is NULL };
                   while (iter.next()) {
                        ident =      iter.elt_id();
                        listCode =      iter.elt_lst_code();
                        lib =           iter.elt_lib();
                        actif =          String.valueOf(iter.elt_actif());
                        #sql [connA]] { insert into BIBLIO_0 (ID, LIBELLE) values (:ident, :lib) };
                   #sql [[connA]] { COMMIT};
              } finally {
                   connB.close();
                   connA.close();
    h5. 2- Loadjava
    loadjava -u user/pwd@connA -v -resolve TestInsert.java
    it returns a warning :
    Impossible to check SQL instruction
    +#sql [connB] iter={ select elt_id, elt_lst_code, elt_lib, elt_actif from baseB.<user>.ELT elt_elt_id is NULL };+
    h5. 3- Create and execute stored procedure
    I connect to baseA through sql*plus and execute the command :
    CREATE OR REPLACE PROCEDURE SP_TESTINSERT AS LANGUAGE JAVA  NAME 'TestInsert.test()';
    EXECUTE SP_TESTINSERT;
    I've got the errors :
    ORA-29532: java call terminated by uncaught java exception :
    java.sql.SQLException: ORA-00903: invalid table name
    ORA-06512: at "BASEB.TESTINSERT", ligne 0
    ORA-06512: at ligne 1
    I've changed :
    +#sql [[connB]] iter={ select elt_id, elt_lst_code, elt_lib, elt_actif from baseB.<user>.ELT elt_elt_id is NULL };+
    to
    +#sql [[connB]] iter={ select elt_id, elt_lst_code, elt_lib, elt_actif <user>.ELT elt_elt_id is NULL };+
    but during the compilation (loadjava) I have :
    ORA-29535: source requires recompilation
    TestInsert:23: Impossible to check SQL interrogation. ORA-00903: invalid table name
    #sql [connGeochim] iter={ select elt_id, elt_lst_code, elt_lib, elt_actif from
    <user>.ELT elt_elt_id is NULL };
    ^
    <no file>: Processing source TestInsert encountered sqlj translation failed.
    Info: 2 errors
    The following operations failed
    source TestInsert: resolution
    exiting : Failures occurred during processing
    thanks

  • SQLJ bug or my problem?

    context = new InitialContext();
    jdbcURL = (DataSource) context.lookup("jdbc/palocintDS");
    conn = jdbcURL.getConnection();
    //Create SQLJ context from JDBC connection...
    DefaultContext connContext = new DefaultContext(conn);
    After creating the connContext above from a DataSource, I can use it for SQLJ SQL queries without error. However, in using any SQLJ Named Iterator for the SQL query, I receive "Invalid Column Index" errors if I use the names themselves in the Iterator (which map to DB column names).
    If, instead, I do a .getResultSet() on the SQLJ Iterator object and then access the columns by index with getString(x), getInt(y) etc (ala JDBC) it works fine.
    Any ideas?
    I'm running this particular application as a Web-Service deployed on Oracle9iAS 9.0.3 from JDeveloper 903.1035.

    Thought I'd add the 3 about implied values:
    InitialContext context = null;
    DataSource jdbcURL = null;
    Connection conn = null;

  • Inheriting Context members from super class

    I have a class which extends an abstract class. That abstract
    class creates the SQLJ context members (protected members). So
    the subclasses can use the contexts. Is there any problem with
    SQLJ with this kind of approach. Because I am having strange
    problems with this.

    ...although the question reminds me of some thing that I have always liked and have not seen in any java IDEs: copy the javadoc description of some field to the getter/sett methods for that field. i.e. some thing like,
    * This field identifies a customer's unique ID in the database
    private int customerID;
    * This method returns 'customerID'.  [start copy]This field identifies....
    public int getCustomerID();

  • SQLJ-JPublisher - J2T-153, Invalid value for -context:while generating the

    Hi All,
    I am trying to generate the java code for the oracle types defined for one of the module in our project.for that i have defined a new context by extending the 'DefaultContext'
    provided by SQLJ and as mentioned in the below URL.
    http://docs.oracle.com/cd/A91202_01/901_doc/java.901/a90214/jpub.htm
    Topic : JPublisher Generation of SQLJ Classes
    MyContext:-
    import java.sql.Connection;
    import java.sql.SQLException;
    import sqlj.runtime.ref.DefaultContext;
    public class MyContext extends sqlj.runtime.ref.DefaultContext{
    static {
    DefaultContext defaultContext = null;
    try {
    defaultContext = new DefaultContext(<datasource>);
    } catch (SQLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    DefaultContext.setDefaultContext(defaultContext);
    public MyContext(Connection arg0) throws SQLException {
    super(arg0);
    public Connection getConnection(){
    Connection con = null;
    try {
    con = <datasource>getConnection();
    } catch (SQLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    return con;
    JPub command:
    jpub -user=usr/pwd -context=com.test.context.MyContext -sql=<My Types Here> -compile=false
    I am getting the below error while running the jpub command in dos prompt.
    Error Log:
    J2T-153, Invalid value for -context: com.test.context.MyContext. This must be set to generated or to DefaultContext.
    Please let me know if anybody has come across this problem before.
    Thanks,
    Vijay
    Edited by: 905698 on 03-Jan-2012 09:53

    Hi Vijay,
    This post DOES NOT correspond to this forum.
    The current forum is for BI Publisher. Your question is for JPublisher and believe it corresponds to PL/SQL forums.
    Please close the thread
    thanks
    Jorge

  • SQLJ Connection Context

    Hi,
    i was trying to create a SQLJ connection context following the procedure given in the following link.
    https://help.sap.com/saphelp_nw04/helpdata/en/70/a19cc472e72c4481172909938578fc/frameset.htm
    But i am getting  error when i am inserting this sqlj statement inside the class Ctx
    public class Ctx
         #sql public context Ctx with (dataSource = "java:comp/env/TMP_PERSISTENCE_EXAMPLE");//here i am getting this error
    Error               
    SQLJ: The ConnectionContext class "Ctx" must not be declared as an inner class of the class "temp.persistence.gettingstarted.dao.Ctx". It may be declared as a static inner class.     Ctx.sqlj     OpenSQLWeb/source/temp/persistence/gettingstarted/dao     
    could u tell me how i can resolve this.

    Hi,
      i think you are refering to the sqlj file
      with reference to the example its ctx.sqlj
      The contents of the file are
    <-- Start -->
    package temp.persistence.gettingstarted.dao;
    #sql public context Ctx with (dataSource = "java:comp/env/TMP_PERSISTENCE_EXAMPLE");
    <-- End -->
    its not a class file.
    If you have installed JDT, you will have the complete working example in 'C:\Program Files\SAP\JDT\eclipse\examples\J2EE_GettingStartedOpenSQL.zip'
    Hope that helps.
    Regards,
    S.Divakar

  • Trouble context in SQLJ (please help)

    Hi,
    I have a problem using "Oracle JDeveloper" as tool to compile sqlj programs.
    I have created a connection conn and I want to use this connection with a context. This is the code that I have writed:
    import java.sql.*;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import sqlj.*;
    import oracle.sqlj.runtime.*;
    import java.util.Vector;
    import sqlj.runtime.*;
    import java.math.*;
    import sqlj.runtime.ConnectionContext;
    public class Sqlj2 {
    public static Connection getConnection1() throws Exception {
    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    String url = "jdbc:Odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=c:/Oracle/Progetto.mdb";
    String username = ";UID=Roberto;";
    String password = "PWD=prova";
    Class.forName(driver); // load MySQL driver
    Connection conn = DriverManager.getConnection(url+username+password);
    return conn;
    public static void main(String[] args) {
    Connection connection1 = null;
    try {
    connection1 = getConnection1();
    #sql context Ctx1;
    Ctx1 context = new Ctx1(connection1);
    #sql [context] { SELECT id_dip,nome_dip,budget FROM Dipartimento WHERE budget > 1000 };
    } catch (Exception e) {
    e.printStackTrace();
    System.exit(1);
    } finally {
    try {
    connection1.close();
    } catch (SQLException e) {
    e.printStackTrace();
    In particular this peace of code give me a trouble:
    Ctx1 context =  new Ctx1(connection1);
    The word "Ctx1" is always red in JDeveloper!!!! I think I import all the classes that I need....
    How can I solve this problem?
    Can you try to run this code to look if the text is red in your compiler?
    Please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Thanks!!!
    Edited by: user1762560 on 2-dic-2008 10.41

    please answer me...it's very important...can you give me the name of another sqlj compiler?

  • SQLJ+JSP

    hello sir
    i am using CMP EJB with SQLJ but my problem is when i use this code
    i am using this code in jsp page for login purpose
    to check login and password in login table
    #sql public context DefaultContext;
    SafeCon sa=new SafeCon();
    ctxx =sa.init();
    #sql [ctxx] {
    select distinct * from login where acc0=:uname and acc1=:upassword
    then it will give the illegal charcter error on # line
    and malformed error so can u pls tell me how to solve it
    i am using jdeveloper
    thanks alot

    I will answer myself, so people that has the same problem can see this:
    Make a jsp page (callingprogram.jsp) that calls the following file: EXECUTESQLJ.jsp (the file name could be whatever):
    -- CALLINGPROGRAM.JSP --
    <%@ page contentType="text/html;charset=windows-1252"%>
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
    <TITLE>
    jsp to execute a pl/sql (sqlj)
    </TITLE>
    </HEAD>
    <BODY>
    Ejecutar un PL/SQL es cuestion de colocar el codigo en JAVA respectivo:
    <FORM method="post" action="executesqlj.jsp" onreset="alert('LA FORMA ES REINICIADA')">
    Presione el boton --><INPUT type="submit" value="Ejecutar">
    <BR>
    Para Reiniciar valores presione ---> <INPUT type="reset" value="Reiniciar"></TD>
    </FORM>
    </BODY>
    </HTML>
    Then, the file EXECUTESQLJ.JSP should has a look like this:
    <%@ page language="sqlj"
    contentType="text/html;charset=windows-1252"
    import="oracle.jbo.*,
    java.sql.SQLException,sqlj.runtime.ref.DefaultContext,
    sqlj.runtime.ConnectionContext,java.sql.Connection,
    oracle.sqlj.runtime.Oracle,mypackage1.java2" %>
    <-- mypackage1.java2 is the wrapper sqlj that the JDEV has created with the option GENERATE JAVA... -->
    <HTML>
    <HEAD>
    <TITLE>
    Executing sqlj....
    </TITLE>
    </HEAD>
    <BODY>
    <% // Codificacion de Java para llamar el procedimiento.
    Oracle.connect(new java2().getClass(), "connect.properties");
    <% /* remember creating the file connect.properties in your package directory
    The file has to be like this:
    sqlj.url=jdbc:oracle:thin:@servidor:1521:ORCL
    # User name and password here (edit to use different user/password)
    sqlj.user=scott
    sqlj.password=tiger
    */ %>
    java2 execsql = new java2();
    execsql.testjava();
    %>
    <jsp:forward page="callingprogram.jsp" />
    </BODY>
    </HTML>
    Hope this could help the jdevs guys!.

  • Problem with SQLJ

    I am using SQLJ but cant seem to get the Named Iterators to work.
    // None None
    package db_interface;
    import oracle.jdbc.OracleDriver;
    import oracle.jdbc.*;
    import entity.*;
    import java.sql.SQLException;
    import java.sql.PreparedStatement;
    import java.sql.Statement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.*;
    import sqlj.runtime.*;
    import oracle.sqlj.runtime.*;
    import sqlj.runtime.ref.DefaultContext;
    #sql public static iterator Employee_Iter
    (int employee_id, String employee_dept, String first_name, String family_name, String login_name, String employee_email);
    public void retrieveEmployee(String username) throws SQLException
    System.out.println("Preparing to insert username: " + username);
    Employee_Iter iter = null;
    #sql [context] iter = { VALUES(comp326_2.retrieveEmployee(:in username)) };
    while (iter.next())
    System.out.println("Employee ID: " + iter.employee_id());
    System.out.println("Employee_Name: " + iter.first_name()
    + " " + iter.family_name());
    iter.close();
    And the program here is fine, and it compiles and run, but i get the error in the program invalid column name, and I am not sure why...
    My schema is this:
    /*==============================================================*/
    /* Table: Employee */
    /*==============================================================*/
    create table Employee
         employee_id INTEGER NOT NULL,
         employee_dept VARCHAR(20) NOT NULL,
         first_name VARCHAR(20),
         family_name VARCHAR(40) NOT NULL,
         login_name VARCHAR(40) NOT NULL,
         employee_email VARCHAR(60) NOT NULL,
         CONSTRAINT PK_Employee PRIMARY KEY (employee_id)
    Now I have tried once and again to get it working...
    But running out of ideas help =)

    Oopsie forgot this:
    create or replace package comp326_2 as
         type ref_cursor is REF CURSOR;
         function retrieveEmployee(username IN varchar) return ref_cursor;
    create or replace package body comp326_2 is
         function retrieveEmployee(username IN VARCHAR) return ref_cursor is
              employee_details ref_cursor;
              user_not_found exception;
         begin
              open employee_details for          
              select * from Employee where login_name = username;
              if employee_details%NOTFOUND then
                   raise user_not_found;
              end if;
              return employee_details;
         exception
              when user_not_found then
                   raise_application_error(-20010, 'User not found!');
         end retrieveEmployee;

  • SQLJ: unable to find input file null   (Error while building EJB.jar file)

    Hi,
    I am working on open SQL/SQLJ with the following details
    Name:Employee application(adding an employee to MAXDB through SQLJ connection)
    FRONT-END:JSP/SERVLET
    Middle:Stateless bean with DAO(DB connection) coming from SQLJ
    Back-end:MAXDB
    I have following in abc.sqlj file
    #sql public context Connx with (dataSource = "java:comp/env/jdbc/SAPTSTDB")
    and creating instance and adding to DB in another say xyz.sqlj file
              Connx con = null;
              try{
                   con = new Connx();
                        #sql [con] {insert into TMP_DB1(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL)
                        values(:(employeeDTO.getEmployeeId()),
                                 :(employeeDTO.getFirstName()),
                                 :(employeeDTO.getLastName()),
                                 :(employeeDTO.getEmail()))};
    My build has no errors..but while building EJB archive with above sqlj files, am getting following error
    "SQLJ: unable to find input file null" for both sqlj files.
    Anybody faced this kind of issue, pls reply back.
    Thanks
    parveen

    Hi,
    I am working on open SQL/SQLJ with the following details
    Name:Employee application(adding an employee to MAXDB through SQLJ connection)
    FRONT-END:JSP/SERVLET
    Middle:Stateless bean with DAO(DB connection) coming from SQLJ
    Back-end:MAXDB
    I have following in abc.sqlj file
    #sql public context Connx with (dataSource = "java:comp/env/jdbc/SAPTSTDB")
    and creating instance and adding to DB in another say xyz.sqlj file
              Connx con = null;
              try{
                   con = new Connx();
                        #sql [con] {insert into TMP_DB1(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL)
                        values(:(employeeDTO.getEmployeeId()),
                                 :(employeeDTO.getFirstName()),
                                 :(employeeDTO.getLastName()),
                                 :(employeeDTO.getEmail()))};
    My build has no errors..but while building EJB archive with above sqlj files, am getting following error
    "SQLJ: unable to find input file null" for both sqlj files.
    Anybody faced this kind of issue, pls reply back.
    Thanks
    parveen

  • Error in solving MultiSchema.sqlj

    Hello there,
    I am trying to solve Multischema.sqlj example given in sample
    examples of sqlj with slight moditications. My emp table is
    having scott schema and dept table is having sheetal schema.
    The compilation fails at
    #sql (deptCtx) {
    SELECT dname INTO :dname FROM sdept WHERE deptno = :deptno
    stating error as "missing equal to sign".
    can anybody help me to come out of this mess?
    A complete program is as follows :
    import java.sql.SQLException;
    import java.sql.DriverManager;
    import java.sql.Driver;
    import java.sql.Connection;
    // declare a new context class for obtaining departments
    #sql context DeptContext;
    #sql iterator Employees (String ename, int deptno);
    class MultiSchema
    public static void main(String[] args) throws SQLException
    // Create the default context used to query employees.
    ConnectionManager.initContext();
    // Create a context for querying department info using
    // a second connection. Edit the URL2, UID2, and PWD2
    // strings for a connection and schema available to you.
    String DRIVER = "oracle.jdbc.driver.OracleDriver";
    String URL2 = "jdbc:oracle:thin:@garuda:1521:orcl";
    String UID2 = "sheetal";
    String PWD2 = "sheetal";
    Boolean flg = false ;
    Connection conn = null;
    try {
    Driver d = (Driver) (Class.forName(DRIVER).newInstance());
    DriverManager.registerDriver(d);
    } catch (Exception ex) {
    System.err.println("Could not load driver: " + DRIVER);
    ex.printStackTrace();
    System.exit(1);
    try {
    conn = DriverManager.getConnection(URL2, UID2, PWD2, flg);
    } catch (SQLException ex) {
    System.err.println("Could not get another connection");
    ex.printStackTrace();
    System.exit(1);
    DeptContext deptCtx = new DeptContext(conn);
    new MultiSchema().printEmployees(deptCtx);
    deptCtx.close();
    // Performs a join on deptno field of two tables accessed from
    // different connections.
    void printEmployees(DeptContext deptCtx) throws SQLException
    // obtain the employees from the default context
    Employees emps;
    #sql emps = { SELECT ename, deptno FROM emp };
    // For each employee, obtain the department name
    // using the dept table connection context.
    while (emps.next()) {
    String dname;
    int deptno = emps.deptno();
    #sql (deptCtx) {
    SELECT dname INTO :dname FROM sdept WHERE deptno = :deptno
    }; // I GET AN ERROR HERE as MISSING EQUAL SIGN IN
    ASSIGNMENT
    System.out.println("employee: " emps.ename()",department:"
    + dname);
    emps.close();
    thanking you in advance,
    -Sheetal
    null

    Are you using JDK 1.2.1? If yes, then try to use JDK 1.2.2 instead. We have seen JDK 1.2.1 garbage collecting things that are still in scope (very unsafe).
    If wiggling your configuration does not help, you'll need to provide more info about your environment and it would be best to get a reproducible test case.
    One other note: make sure to finally close the SQLJ iterator not the result set that is being returned. Otherwise you can start leaking cursor handles and/or statement cleanup will not be properly performed.

  • JDBC/SQLJ Team - Please respond - invalid column type error

    Hi, I have posted several messages regarding problems using SQL/J to call out a stored packaged function that returns a ref cursor, but haven't gotten one response. I have yet a new problem with it. JDBC team, please acknowledge!
    I change the way I obtain a connection to the database from using the Oracle.connect along with a properties file, to now using a DataSource connection pool. As a result, I am constantly getting a SQLException: Invalid column type error. If I change the call to the stored function to a query in the SQLJ code, it's fine. What's going on??
    A previous message I wrote stated I was constantly getting a "closed statement" error when I tried to call the next method of the iterator. I corrected this by removing the finally clause in the generated JDBC code that released the execution context.
    Again, the environment is JDK1.2.2, SQLJ 8.1.6 SDK, JDBC 8.1.6 thin, all on NT.
    Thanks
    David

    I am getting the same error message - Invalid Column Type. I am creating a Default Context by calling Oracle.getConnection(connection) passing in an instance of my own connection class that basically delegates to the OracleConnection. We wrapped the Connection so that we could trap and recover from lost database connections.
    My environment is Solaris 2.6, Oracle 7.3.4 with Sqlj 8.0.5.
    Thanks!
    [email protected]
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by David Christopher ([email protected]):
    Hi, I have posted several messages regarding problems using SQL/J to call out a stored packaged function that returns a ref cursor, but haven't gotten one response. I have yet a new problem with it. JDBC team, please acknowledge!
    I change the way I obtain a connection to the database from using the Oracle.connect along with a properties file, to now using a DataSource connection pool. As a result, I am constantly getting a SQLException: Invalid column type error. If I change the call to the stored function to a query in the SQLJ code, it's fine. What's going on??
    A previous message I wrote stated I was constantly getting a "closed statement" error when I tried to call the next method of the iterator. I corrected this by removing the finally clause in the generated JDBC code that released the execution context.
    Again, the environment is JDK1.2.2, SQLJ 8.1.6 SDK, JDBC 8.1.6 thin, all on NT.
    Thanks
    David<HR></BLOCKQUOTE>
    null

  • SQLJ use in Web Dynpro

    Dear All.
    How can i use my SQLJ and other helper classes (DB engine) in Web Dynpro? Where can i create the connection context? Is it possible, to use java relational persistence in Web Dynpro without EJB model?
    Best Regards, Andrey.

    Hi Andrey,
    you should wrap your SQLJ related classes behind some EJB module project and another application project. You can create the Connection Context class and other SQLJ classes just by saying File>New>Other>Persistence>SQLJ Source. So first create your connection context class there and llok up for the Datasource alias as defined in your application.xml file in your application project. Later on in the business methods of your session bean you can access these sqlj helper classes for processing ad access the business methods from web dynpro through EJB project reference or local web service model.
    For relational persistence you can use JDO if you dont want to use EJB CMP. Though for JDO, there are no wizards in NWDS for creating the .map or .jdo files. So you have to create these files by your own and have to take care of syntactical errors as in any xml.
    Regards,
    Shubhadip

  • SQLJ error in stored procedure

    Okay I'm kind of new to this stuff so this is probably an easy
    question but I can't fix my current problem. Know I have been
    creating and compiling several java stored procedures in my
    oracle 8.1.7.0.0 enterprise edition database. So far everything
    is create I have created about a dozen and done all of their
    call specs and everything works without a hitch.
    The problem I have came into being when I tried to create a
    stored procedure that uses SQLJ. When I create my stored
    procedures I compile my java code straight into the database
    using the
    CREATE OR REPLACE AND COMPILE JAVA SOURCE named "myClass" AS
    source
    this has always worked from me except when I place my
    #sql ; lines at which point it issues a the following error
    SP2-7034 : unknown command beginning
    at which point is it ignores the line of code and continues to
    compile my java source. Does this mean the SQLJ is not enabled
    in my database or what? I have checked out the SQLJ developer&#8217;s
    hand book and it did not help me with this problem. Oh please
    wont some wise oracle god help me!

    user21354 wrote:
    i am creating the collection in my Stored procedure it is giving me this error
    declare
    type t_number is table of number;
    v_numbers t_number;
    begin
    select VISIT_ID
    bulk collect into v_numbers
    from visit
    where VISITTYPEID = 2;
    select VISIT_ID from v_numbers;
    end;
    error
    PL/SQL: ORA-00942: table or view does not exist
    please tell me this why this happeningcouple of things...
    context switching - Your second 'select visit_id' query is actually parsed outside plsql, in the 'sql engine'. This sql engine has no knowledge of what v_numbers is, it's expecting an actual table name but it can't find anything called v_numbers in it's metadata. So it bombs out with that error. Google 'context switching plsql' for more info. :o)
    - as v_numbers is a collection, you could just loop through the results:
      for n in 1..v_numbers.count
      loop
        dbms_output.put_line(v_numbers(n));
      end loop;- as stated above, a 'select' without 'into' won't work in plsql anyway.
    - there is a way of getting round the context switch, by creating your Type in sql rather than plsql and 'casting' it to a table. Let us know if you want to know the steps to do it, but try reading up on context switch first.
    cheers.

  • Error in SQLJ..Please guide :(

    Hello All,
    Am new to SQLJ and am implementing the first practise project from pdf called "<i><b>Gettng Started with Relational Persistence</b></i>".
    Am at the step wherein The <i>Data Access Interface has been implemented using SQLJ</i> but am getting these 2 errors at this step:
    1. <b>SQLJ: The connecttion "ctx" does not have a Java type</b>.
    2. <b>SQLJ: The context type must e defined explicitly</b>.
    Please help me resolve these errors.
    Awaiting Reply.
    Thanks & Warm Regards,
    Ritu

    Hello,
    I have implemented the first sample program on Persistence from help.sap.com
    As per that, u dont have to add the Dict. project to the enterprise project.
    If you are referring to thr same project then:
    1. Creation of dictionary project
    2. Created a Web Project (with servlet & JSP) & addition of Dic project.
    3. Creation of Enterprise Project and addition of the above Web project.
    You may also refer to the steps given here:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/b8/092492099b7c44b266c3128624076e/frameset.htm

Maybe you are looking for

  • Open files window cuts off file name and features date

    How do I change this annoying behavior?   Happens every time I need to open a new file within InDesign.

  • Periodic discount accounting for accounts payable

    Hi, In case company is entitled for predefined vendor discount based on slabs & client wants to book the same based on invoice wise. For example :- 1. If volume upto 100000 then 1%discount on whole amount. 2. If volume upto 200000 then 2% discount on

  • Oracle Patch error

    Hi All, I am applying oracle patch 10.2.0.3 on 10.2.0.1 on SUSE 9. However it prompts to select the "Inventory Directory" and I choose /u01/app/oracle/OraInventory which is already populated on the screen. When I click on next it prompts with an erro

  • Untrusted root certificates?

    So I was browsing my computer today (checking out another problem I'm not so concerned about) and I noticed something. In my Keychain, under "System", I have 2 certificates listed as "This root certificate is not trusted". Both have names starting wi

  • Looping within table query

    Hi all, I've run into a problem... Is there anyway where we can do looping in a table in a single SQL query. Basically the scenario is like this : *Consider a table with sample data as follows: SQL> select * from TEST2; EMPNO JOB REL_DT 1 SALESMAN 01