Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: JDeveloper (Urgent)

Re: JDeveloper (Urgent)

From: Mark Will <Mark.Will_at_gems6.gov.bc.ca>
Date: Mon, 20 Sep 1999 13:07:44 -0700
Message-ID: <thMcih9nJm7u@vmsmail.gov.bc.ca>


You need to either:
(i) wrap the call to the sqlj method in a try-catch block

void jButton1_actionPerformed(ActionEvent e) {

    int tpr_number = Integer.parseInt(jTextField1.getText());     try {

        file_name.submit_tpr_number(tpr_number);     } catch (Exception e) {

        System.out.println( e.getMessage() );     }
}

or

(ii) modify the calling method (if you can) so that it throws the same exception (in this case, a generic Exception object) that the sqlj method throws.

void jButton1_actionPerformed(ActionEvent e) throws Exception {

    int tpr_number = Integer.parseInt(jTextField1.getText());     file_name.submit_tpr_number(tpr_number); }

In the latter case, you will have to modify every call of jButton1_actionPerformed() to "catch" the exception as shown in (i). Probably messy, so I recommend (i) if you can do it.

I don't have any examples handy for integrating database values with Java containers (still trying to gather goodies like this) but you might want to try looking at a simple infobus example's code. I suggest trying the JDeveloper tutorial for infobus, then print out the source. You might find you even prefer the provided infobus controls.



Mark Will
Mark.Will_at_gems6.gov.bc.ca

Tarek Shaar <tareks_at_syslogic.com> wrote in message news:37e26037.25179776_at_news.demon.co.uk...
> Hello every one.
>
> I am currently developing a Java project that talks to an Oracle 8i
> server. The tool I am using to develop the software is JDeveloper 2.0.
> I am having probelms in writting the integer value entered by the user
> in a text field to the corresponding field in the database. The
> connection seems to be fine but the problem is in the method that does
> the actual insert in the data base. The SQL query that does the actual
> insert in the database in embeded in a Java file with an extention of
> .sqlj
> the method is a static one in the file and I am calling this method in
> the file that has the the text fileld where the data is entered.
> The method is as follows:
>
> static void submit _tpr_number(int tpr_no)
> throws Exception {
> #sql { insert into problem_report
> (TPR_NO) values
> (:tpr_no)};
> } (This method is within a file called updates.sqlj)
>
> I then calll this method in the other file as follows:
>
> void jButton1_actionPerformed(ActionEvent e) {
> int tpr_number = Integer.parseInt(jTextField1.getText());
> file_name.submit_tpr_number(tpr_number);
> }
> which is meant to submit the data entered in the text field to the
> database on clicking the button jButton1.
> the error message is as follows:
>
> Error:(53) unreported exception: java.lang.Exception; must be caught
> or declared to be thrown.(The tool points at the line where I am
> calling the method)
>
> I would appreciate it if any body could help.
> Also if any one has any useful information about JDeveloper which
> will enable me to read data from a database into various
> controls(choice, tree, grid, table)
> or any other information about JDeveloper 2.0 then please reply to
> this message as soon as possible.
>
> Thanks every one
>
> Tarek
Received on Mon Sep 20 1999 - 15:07:44 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US