?
Solved

Run JDBC application fromJava Applet

Posted on 2003-03-17
15
Medium Priority
?
242 Views
Last Modified: 2013-11-23
I have a JDBC file which read data from Oracle and write data into XML files. Now I need to write an applet so the applet will send a string from user to this JDBC application, then this application could start search the Oracle DB. In my applet, the code of calling the JDBC application is as following:
       
        String text = textField.getText();
        textArea.append(text + newline);
        textArea.removeAll();        
        textArea.setText(new String ("Please wait, the system is generating the XML file"));
     cacc = new CatalogConnect(text);
     textArea.setText(new String ("Please go to take a look at the the XML file"));    

CatalogConnect.java is the JDBC application. textField is where the user enter a string.

In my appletviewer, I got this error:
java.lang.NoClassDefFoundError: Oracle/jdbc/driver/OracleDriver
    at CatalogConnect.connect(CatalogConnect.java:38)

I run the CatalogConnect.java and this applet on same machine, and the ClassPath and Path are set up. I don't know how to solve this problem. I have write simple applet before, not as complicated as this one. I read something about applet which says that applet could out do I/O and output a file, I wonder what should I do.

Thank you so much.




0
Comment
Question by:hollyhw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
15 Comments
 
LVL 9

Expert Comment

by:Ovi
ID: 8153209
check the archive parameter inside your <applet> and put there the path to the jdbc driver, among with your applet archive.
0
 

Author Comment

by:hollyhw
ID: 8159436
Thank you. But can you provide an example? I do get confused. The Oracle driver is a zip file, and I put it in the same path with my applet and other java classes, then direct the codebase to it
<APPLET codebase="http://mypathbehindfiarwall/" CODE="TextDemo.class" WIDTH=300 HEIGHT=125>
</APPLET>
But still nothing changed. I am so confused.

Thank you.
0
 

Author Comment

by:hollyhw
ID: 8159551
Thank you. But can you provide an example? I do get confused. The Oracle driver is a zip file, and I put it in the same path with my applet and other java classes, then direct the codebase to it
<APPLET codebase="http://mypathbehindfiarwall/" CODE="TextDemo.class" WIDTH=300 HEIGHT=125>
</APPLET>
But still nothing changed. I am so confused.

Thank you.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:hollyhw
ID: 8159552
Thank you. But can you provide an example? I do get confused. The Oracle driver is a zip file, and I put it in the same path with my applet and other java classes, then direct the codebase to it
<APPLET codebase="http://mypathbehindfiarwall/" CODE="TextDemo.class" WIDTH=300 HEIGHT=125>
</APPLET>
But still nothing changed. I am so confused.

Thank you.
0
 
LVL 9

Expert Comment

by:Ovi
ID: 8159904
<APPLET codebase="." ARCHIVE="path to your driver" CODE="TextDemo.class" WIDTH=300 HEIGHT=125>
</APPLET>

if this will not work, you should try to jar your applet and use this tag :

<APPLET codebase="." ARCHIVE="path to your driver,path to your applet jar" CODE="TextDemo.class" WIDTH=300 HEIGHT=125>
</APPLET>

instead of codebase="http://mypathbehindfiarwall/" you should use "." or a relatve path to your applet directory. The users should not know from where exactly the applet comes.
0
 
LVL 9

Expert Comment

by:Ovi
ID: 8159914
btw it is not important if the archive is a zip, jar or cab file. Should write something like:

<APPLET codebase="." ARCHIVE="oracleDriver.zip" CODE="TextDemo.class" WIDTH=300 HEIGHT=125>
</APPLET>
0
 

Author Comment

by:hollyhw
ID: 8167102
Thank you, Ovi, at least I got a different error message in my Appletviewer:

java.security.AccessControlException: access denied (java.net.socketpermission  myip:1521 connect, resolve)

I am making an important progress with help from you! Thank you so so much!
0
 
LVL 9

Accepted Solution

by:
Ovi earned 120 total points
ID: 8167232
this means you have a sequrity exception, possibly you are trying to connect to a different "server" - to another host different from one where the applet comes. If the applet connect to a different server it should be signed ...
0
 

Author Comment

by:hollyhw
ID: 8167363
Ovi:
After I read information from here, I guess I have to write a client and server socket connect. Write applet as a client , and run a server on my web server, this server will access Oracle and generate a XML file. Althought I don't want to do it this way, seems there is no solution.

Thank you so so so much.

http://forum.java.sun.com/thread.jsp?thread=86349&forum=48&message=1107105
0
 

Author Comment

by:hollyhw
ID: 8167381
Ovi:
After I read information from here, I guess I have to write a client and server socket connect. Write applet as a client , and run a server on my web server, this server will access Oracle and generate a XML file. Althought I don't want to do it this way, seems there is no solution.

Thank you so so so much.

http://forum.java.sun.com/thread.jsp?thread=86349&forum=48&message=1107105
0
 

Author Comment

by:hollyhw
ID: 8167426
Ovi:
After I read information from here, I guess I have to write a client and server socket connect. Write applet as a client , and run a server on my web server, this server will access Oracle and generate a XML file. Althought I don't want to do it this way, seems there is no solution.

Thank you so so so much.

http://forum.java.sun.com/thread.jsp?thread=86349&forum=48&message=1107105
0
 
LVL 9

Expert Comment

by:Ovi
ID: 8168200
good luck.
0
 

Expert Comment

by:CleanupPing
ID: 9058642
hollyhw:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9726841
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept Ovi's comment as answer.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jimmack
EE Cleanup Volunteer
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses
Course of the Month13 days, 19 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question