PL/SQL package converted to java

Hi everyone!
I have a question. Has anyone use this function of jdeveloper?
I mean the option of take a PL/SQL and convert it to .java with jDeveloper 11gTP4.
I´m prooving it, and I´m having some problems with the code that jdeveloper insert.
sqlj.runtime.ref.DefaultContext __sJT_cc = getConnectionContext();
if (__sJT_cc==null)
sqlj.runtime.error.RuntimeRefErrors.raise_NULL_CONN_CTX();
If someone have experience with this? ....
Thanks,
Rowan

Sorry for not explaining well
After this code:
sqlj.runtime.ref.DefaultContext __sJT_cc = getConnectionContext();
if (__sJT_cc==null)
sqlj.runtime.error.RuntimeRefErrors.raise_NULL_CONN_CTX();
I´ve got the next error:
ADVERTENCIA: java.lang.NullPointerException
javax.faces.el.EvaluationException: java.lang.NullPointerException
     at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
     at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
     at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
My app, is a table and a button to modify a Row.
Rowan

Similar Messages

  • Generating Java wrappers for PL/SQL Packages in JDeveloper 3.1

    I have not been successful in using JD3.1 to generate java classes for use in calling PL/SQL packages from a Java Servlet I am developing. I have followed the directions under the 'Generating Java Code for Oracle Objects and PL/SQL Packages' help topic: I display the package in the database browser window, right click on the package, select 'Generate Java', and click 'OK' on the pop-up JPublisher window that appears. The wizard clocks out for a few moments, then the JPublisher window disappears, but the java class is not added to JDeveloper's Navigation pane for the Project and Package I specified in the wizard.
    Any idea where the generated class is going to?

    should be, but isn't... JDeveloper3.1
    (build 681) default install... Is it in
    a custom package I didn't install? Or
    am I just a dumb nut?Hmm.. I thought it was in there.. JPub is a java based tool. You can invoke it as such.
    1st, use setvars.bat from your jdeveloper/bin directory.
    2nd, run java oracle.jpub.java.Main (pass it the same arguments as you would the jpub.exe)
    Here's the output from my machine here:
    D:\JDeveloper31\bin>setvars D:\JDeveloper31
    Setting JDeveloper 1.2 runtime environment to "D:\JDeveloper31"
    Setting JDK version 1.2 in "D:\JDeveloper31\java1.2"
    D:\JDeveloper31\bin>java oracle.jpub.java.Main
    JPub: Java Object Type Publisher, version 8.1.6.0.0 Production
    (and the rest of the help)
    Take Care,
    Rob
    null

  • Pass table rowtype between java class and PL/SQL package

    I am a complete newbie when it comes to java itself but I've been asked to investigate the possibility of passing a rowtype datatype from a PL/SQL package to a java class and vice versa.
    I have heard of oracle.sql.ArrayDescriptor as an option but this appears to address only SQL types that are defined outside of a package.
    I'm talking about using, say, SCOTT.EMP%rowtype instead of a user-defined type. I'm thinking that a java array could be defined from the definition of a table in the database but I don't know what class would be appropriate.
    Could someone provide a simple proof-of-concept example that shows how you could use a java array to pass data to a package that is expecting a table rowtype variable and conversely a java class that reads the rowtype returned into a java array?
    Would oracle.jdbc.driver.OracleDatabaseMetaData be a way of doing this?
    Thanks!

    Kuassi:
    <br><br>
    Not at all. I didn't feel like you misled me at all. I'm grateful for your help. I think that maybe I failed to describe my problem adequately in the first place.
    <br><br>
    Perhaps I've also gotten stuck on the term <i>ref cursor</i>.
    <br><br> At any rate, the people I'm gathering information for have further refined their requirement. We want to take a collection of data and send it to a procedure. It doesn't have to be a "ref cursor" or "%rowtype" per se, but something that is maintainable and workable from both ends.
    <br><br>
    For example, to use the old SCOTT/TIGER paradigm, let's suppose we have a website where you can indicate which employees work for a given department. The website allows us to fill in information for multiple employees at once. We want to use a servlet that gathers all the employees data and sends it on through to a PL/SQL package so that the data is validated and committed in the database.<br><br>
    Perhaps the java servlet should handle the multiple employee records as an array? If so, how can a PL/SQL procedure be made to recognize that construct?<br><br>
    I can accept that java cannot create a "ref cursor" type to send information to a package, but might this be possible via some other implementation?
    <br><br>
    Hopefully this is a little more clear. If not, please let me know and I'll try to inject more details as to what we are trying to accomplish.
    <br><br>
    Once again, thanks for your persistent replies and help.
    <br>

  • Need Info Regarding Implementaion of Interfaces in java.sql package

    Hi All,
    I am interested in knowing details abt how the Interfaces in the java.sql package are implemented. We all work with the database using the interfaces provided ,but how do they work at the backend ? How can a Interface provide details (work ) with out an implementation class.I Is this taken care by the JVM or some of the Call level interfaces? Please do provide details abt this..

    hi Sheshadri,
    The implementation of the various interfaces in
    java.sql package are provided by your jdbc driver,
    which also manages the connection and communication of
    your java program with the appropriate database.
    cheers,
    -Jer

  • Cannot convert from java.util.Date to java.sql.Date

    In the below code am trying to get the current date and 60 days prior date:
    Date  todayDate;
              Date  Sixtydaysprior;
              String DATE_FORMAT = "MM/dd/yy";
              DateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
             Calendar cal = Calendar.getInstance();
              todayDate = sdf.parse(sdf.format(cal.getTime()));
              cal.add(Calendar.DATE, -60);
             Sixtydaysprior = sdf.parse(sdf.format(cal.getTime()));I have imported following files:
    <%@page
         import="java.util.Calendar,
                   java.text.SimpleDateFormat,
                   java.text.ParseException,
                            java.util.*"
    %>Shows up following error msg:
    Type mismatch: cannot convert from java.util.Date to java.sql.Date
    Thanks.
    Edited by: MiltonDetroja on May 22, 2009 11:03 AM

    Shows up following error msg:
    Type mismatch: cannot convert from java.util.Date to java.sql.Date
    I don't think this exception is thrown from the portion of code you have shown. As clearly specified in exception message, you cannot cast an instance of java.util.Date to java.sql.Date. you will need to do something like this
    java.util.Date today = new java.util.Date();
    long t = today.getTime();
    java.sql.Date dt = new java.sql.Date(t);

  • Problem in generate Java  from PL SQL package in Jdeveloper

    Hi
    i have problem in create java class from PL SQL package in JDeveloper.
    I use Database navigator of jdeveloper and right click on a package and choose Generate Java then in Jpublisher window choose my view Controller and accept other default values.
    I call methods of generated class in the Action of a button in my JSP page, but when I click the button it  throw null pointer exception !!! i fund one of generated method return null and it lead to this exception.
    protected DefaultContext __tx = null;
    public DefaultContext getConnectionContext() throws SQLException  {
    if (__tx==null){
    __tx = (getConnection()==null) ? DefaultContext.getDefaultContext() : new DefaultContext(getConnection());
        return __tx;
      public Connection getConnection() throws SQLException
        if (__onn!=null) return __onn;
         else if (__tx!=null) return __tx.getConnection();
         else if (__dataSource!=null) __onn= __dataSource.getConnection();
         return __onn;
    i try to generate class in Model project and create DataControl for that and use method action but noting change and i get null pointer again!!
    Jdeveloper Versino = 11.1.1.7.0

    Let me ask you another question: Why do you generate java from the package at all?
    Where do you want to call the package?
    Back to your question: you should see code like
        public void setDataSourceLocation(String dataSourceLocation) throws SQLException {
            javax.sql.DataSource dataSource;
            try {
                Class cls = Class.forName("javax.naming.InitialContext");
                Object ctx = cls.newInstance();
                java.lang.reflect.Method meth = cls.getMethod("lookup", new Class[] { String.class });
                dataSource = (javax.sql.DataSource) meth.invoke(ctx, new Object[] { "java:comp/env/" + dataSourceLocation });
                setDataSource(dataSource);
            } catch (Exception e) {
                throw new java.sql.SQLException("Error initializing DataSource at " + dataSourceLocation + ": " + e.getMessage());
    in the generated code. This code look up a datasource (which you have defined e.g. on the Weblogic Server) by calling the method
    setDataSourceLocaltion("jdbc/HRConnDS");
    This look up the datasource nad stores it in the class variable.
    Timo

  • Calling SQL packages from java

    How do I call ORACLE sql packages from java?
    We are still using Oracle 7.3. Any sample code
    would be appreciated.

    utility.processPLSQL( connRisk,
    " Begin "
    + " hvar_sum.p_load_var_summary_data("
    + " '" + dfCall.format( priceDate ) + "', "
    + " '" + promptMonth + "',"
    + daysBack + ","
    + aliasType + ","
    + "'" + connRisk.owner + "'"
    + "); "
    + " end ; ",
    "Load VaR Summary Data",
    utility.noLogMsg ) ;
    public boolean processPLSQL(
    MyConnection conn,
    String sql,
    String dataType,
    boolean createLogMessage ) {
    double startTime = conn.log.getStartTime() ;
    try {
    CallableStatement cs = conn.theConnection.prepareCall(sql);
    cs.execute() ;
    cs.close() ;
    conn.theConnection.commit();
    if ( createLogMessage ) conn.log.logTiming( dataType, startTime ) ;
    } catch ( SQLException e ) {
    conn.log.logError( "Utility.processPLSQL; SQLException Error: " + e ) ;
    System.out.println(new java.util.Date().toString() + "; User: " + conn.user
    + "; SQL: " + sql );
    return false ;
    return true ;
    }

  • Help with Java.Sql package download

    I am compiling some java files with the following :
    import java.sql.*
    and getting errors. I realize I need the java.sql package. Can anyone help me by pointing out where I can download the package?
    Thanks.
    Murthy Gandikota

    This package comes with the JDK. what are your specific problems.

  • Regd Java.sql package

    Hi all
    i want to know whether java.sql package will be automatically installed when i install jdk1.5 otherwise i have to install is separately with java 3.0api for that package. plzzzz any body help me regd this.

    You'll need to put an oracle driver somewhere in your class path. If you don't already have an Oracle jdbc driver, then you can download one here:
    http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html

  • Getting java.sql package.

    Hi, I need to download the java.sql package in order to connect to an Oracle database. Pl. suggest me a url where I could the above. (Searching sun's website yeilded only the doc files, ".html", which are for reference purpose. I am working on Apache with Oracle 8i as my database installed on Oracle 9i Applciation Server)
    Any suggestions or advise or clues would be a great source of help. Thankyou!
    Amit.

    the java.sql package has been part of java since 1.1 at least. so it is fairly safe to assume that if you have the jdk you have java.sql
    any decent zip/archive program can look in and extract the files in a a jar file.
    you do not need to touch this however. what you need is to get the JDBC driver for Oracle.
    you can get that here...
    http://otn.oracle.com/software/tech/java/sqlj_jdbc/content.html

  • Help converting between Java Dates and SQL Dates

    Hey all,
    I'm working on a JSP to allow a user to enter information about news articles into a mySQL database. I'm using text fields for most of the data, and most of it is transferred correctly when the user hits "Submit." However, I am having a problem with the date field of the mySQL database. Basically I'm trying to retrieve the current date from the JSP page, and then insert this into the date field of the appropriate table when the user hits submit. The problem is that I can't typecast a java.util.Date or even a java.util.Calendar to a java.sql.Date object. I've tried lots of approaches, including creating a new instance of java.util.Calendar, getting all its fields and concatenating them onto the date variable, but this doesn't work.
    Anyone know how I could easily convert between java.util.Date or java.util.Calendar and java.sql.Date?
    Thanks!

    Thanks for the help!
    I can correctly display the current date on the page in java.sql.Date format now, but it's still not being inserted into the database correctly. The specific code is as follows:
    java.util.Date dt = new java.util.Date();
    java.sql.Date sqlDate = new java.sql.Date(dt.getTime());
    (As you wrote)
    Then (after connecting to the database etc.):
    PreparedStatement pstmt = con.prepareStatement("INSERT INTO NEWS(NEWSDATE,DAYOFWEEK,AUTHOR,HEADLINE,CLIP,PUBLICATION,LINK,NEWSLOCATION,DATECREATED,DATEMODIFIED,CATEGORY,KEYWORDS,PHOTOURL,PHOTOGRAPHER,AUDIOURL) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
    pstmt.clearParameters();
    pstmt.setString(1,date);
    pstmt.setString(2,dayofweek);
    pstmt.setString(3,author);
    pstmt.setString(4,headline);
    pstmt.setString(5,clip);
    pstmt.setString(6,publication);
    pstmt.setString(7,link);
    pstmt.setString(8,newslocation);
    pstmt.setDate(9,sqlDate);
    pstmt.setString(10,datemodified);
    pstmt.setString(11,category);
    pstmt.setString(12,keywords);
    pstmt.setString(13,photoURL);
    pstmt.setString(14,photographer);
    pstmt.setString(15,audioURL);
    int i = pstmt.executeUpdate();
    pstmt.close();
    All the other fields are retrieved with request.getParameter from text fields. Any idea why the DATECREATED field is being updated to all 0's but the others work fine?
    Thanks again.

  • Issue generating java from pl/sql package

    Hi,
    In JDeveloper (11.1.1.6) I am having an issue generating java from a pl/sql package. When I am in the database navigator I right click on the package and select "generate java". This produces some java files, some sqlj files and a <package_name>.javatmp file. When a collegue does the same all files are generated with a .java extension. Can anyone tell me what I can do to generate all java files?
    Thanks,
    Graeme

    It turns out that I was running against a 64-bit JDK. (1.6.0_41.)
    When I changed this to run against a 32 bit JDK (also 1.6.0_41) my problem went away.
    It might be worth noting that my machine is 64 bit.

  • Generate Java option for PL SQL packages

    Hi
    I recently found out that there is a 'generate java' option in the JDeveloper IDE for PLSQL packages, which creates a Java representation of the PLSQL package.
    What is the use of doing this? can anyone share tutorials that makes use of this feature

    This link may helpful
    Oracle PL/SQL Package - DB Adapter

  • JTextfield input Date convert to java.sql.Date

    Hi. I have a textfield for users to input date in 'dd/mm/yyyy' format and I would like to format this input into java.sql.Date to be stored into a database. How should I go about doing that ?
    I did the following:
    SimpleDateFormat formatDate = new SimpleDateFormat("dd/mm/yyyy");
    java.util.Date invoiceDate = formatDate.parse(jTextField3.getText());
    java.sql.Date sqlDate = new java.sql.Date(invoiceDate.getTime());and when I input into jTextField3 the value '28/05/2008' , I found in my database '2008-01-28'. January and May is a few months off and is totally not what I wanted.

    Hi you did you code perfect, but you need to change the pattern for formatting the Date
    dd - date
    mm - minute
    yyyy - year
    here you are parsing month as minute, so the output may wrong..!
    If you need to format properly
    please use the below pattern
    {color:#0000ff}SimpleDateFormat formatDate = new SimpleDateFormat("dd/MM/yyyy");{color}

  • The -dataSource parameter in assemble a web service from a PL/SQL package

    When I use Web Service Assembler to assemble a Web Service from a PL/SQL package, I need to specify the dataSource parameter, e.g.:
    java -jar wsa.jar -plsqlAssemble -sql pkgname -dataSource jdbc/MyDS -dbConnection ... -dbUser scott/tiger ....
    The dataSource also needs to be pre-configured in the data-sources.xml in OC4J.
    I am wondering why dataSource is needed here because the database connection information is already specified on the commandline ( dbConnection and dbUser).
    If I have to specify dataSource, how do I configure data-sources.xml dynamically at run-time (e.g., adding entries)?
    Thanks,
    Jim

    The -dataSource parameter specifies the data-sources.xml entry used at runtime. The database connection info is only for design time use. Typically you make sure data-sources.xml contains an entry with jndi-location of the same name you specifies for -dataSource. To configure data-sources.xml at runtime, it is out of the scope of web services. Please refer to OC4J admin guide. You can probably modify the data-sources.xml file and force OC4J to reconfigure based on the new data-sources.xml file.

Maybe you are looking for

  • Data Merge - Change Text/Cell Characteristics based on Data Value

    I am working on a letter that is sent to our diabetic patients during their birthday month...the letter will contain the last known test results and date for several measures and then recommend action based on those results. The data comes from a tex

  • Delete rows from a database

    Hi, I am a beginner in JSP and I have a problem, I hope my English will be good enough to explain it! I have a web application that displays records in a table from a postgres database. Each row must have a Delete button, so the user can delete the r

  • ArcSight Logger & Cisco SA520W

    Cisco, What's the process to put in a feature request for an SA520W? I recently installed ArcSight logger in my attached VMware test environment, and I found out the SA520W cannot forward syslog events to anything other then UDP 514. ArcSight logger

  • Maximum internal HDD space on Dual G5 (late 2004)?

    I currently have a stock 80 GB and a user-installed 300 GB. I do a lot of video. So I plan to move the 80's contents to the 300, and the 300's contents to a new 750 (Fry's has them on sale this weekend). But I got spooked when I googled for PowerMac

  • Can't find some songs

    I have imported all of my music and organized it in ITUNES, but when I look under the artist name not all of the songs are displayed. However, when I select "songs" from the menu, I am able to find the songs and play them (with the artists' names dis