Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 244
  • Last Modified:

Run JDBC application fromJava Applet

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
hollyhw
Asked:
hollyhw
1 Solution
 
OviCommented:
check the archive parameter inside your <applet> and put there the path to the jdbc driver, among with your applet archive.
0
 
hollyhwAuthor Commented:
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
 
hollyhwAuthor Commented:
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
hollyhwAuthor Commented:
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
 
OviCommented:
<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
 
OviCommented:
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
 
hollyhwAuthor Commented:
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
 
OviCommented:
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
 
hollyhwAuthor Commented:
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
 
hollyhwAuthor Commented:
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
 
hollyhwAuthor Commented:
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
 
OviCommented:
good luck.
0
 
CleanupPingCommented:
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
 
jimmackCommented:
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

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now