Page 1 of 2 12 LastLast
Results 1 to 20 of 24
  1. #1
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Exclamation PHP as JDBC for JApplet?

    In line with this thread of mine.

    Is this possible that you use a .php file as the JDBC for the JApplet JDBC?
    If possible? How could it be implemented? Am I going to use JNI?

    Suggestions are appreciated.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    The .php file would provide a service and return data to the applet. It would be accessed by a URL via an HTTP GET.
    I don't know where the JDBC is used.

  3. #3
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    So... I could use the .php file as a JNI for the JApplet?
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Not sure I follow.
    JNI (Java Native Interface) is used when a java application need to get at some OS function that is NOT available in java.
    I don't know much about PHP, but I thought it provided a server side script that could be accessed by a URL to do a job on a server and return something to it caller. Similar to what asp or jsp do.

  5. #5
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    Yes... Indeed...
    But my problem is found that the link on #1.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,863
    Rep Power
    19

    Default

    Norm, I'll try and paraphrase the thread linked in the OP.

    They've got a problem running an Applet.
    They're getting an "incorrect magic number" error loading up a class in a jar from the server. Now, the value of the magic number looks to me like it's the server handing back a 404 Not Found, implying the jar file is not accessible.

    So, not being an Applet person, I thought the OP might track you down and ask how they should deploy this driver jar on the server and reference it correctly so the Applet will load.

    Does that make sense to you?

  7. #7
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    Pardon for my grammar. But Tolls got the idea correctly. Thanks, Tolls
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Sorry, I missed reading the link.
    The magic number of 1008813135 is from the String: <!DO
    So Tolls guess is probably right, looks like the server is returning an HTML page instead of the class file.
    So how to track down the problem. The html refers to a class via the code= attribute. The class file can be in a jar file referenced by the archive= attribute. There can be more than one jar listed in the archive= attribute.
    Are the jar files all in the same folder on the server? Do any of the classes get loaded successfully?
    As a test of the server, Can you use a URL in a browser to load all of the jar files referenced in the archive= attribute?

    Don't know where to look. So have to look everywhere.

  9. #9
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    I have tried a simple graphics on JApplet on the same link.
    It worked fine.
    Also I've used MVC to run the JApplet running on the index.html. And it work as coded.

    Speaking of the attribute?
    Is that an applet tag attribute? //<attribute archive="">

    If you're aware of XAMPP.
    I've placed the mysql driver on the same directory where the index.html is located.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  10. #10
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Is that an applet tag attribute?
    By applet tag attribute I mean everything between the tag: '<APPLET' and the ending '>'
    code= is one, archive= another
    Can you post the full contents of the applet tag from < to >?

    I thought your problem was that the classes are in different jar files and perhaps the html does not have them referenced. Simple, single jar file applets could work.
    I know nothing about XAMPP

    Having files in the same directory without including a reference to the jar file in the html wouldn't tell the browser what it needs to know: The name and location of the jar/class files. It gets that info from the html page

  11. #11
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    Oh, But the classes where the applet runs is found in another directory inside of the where index.html is located. Is that a factor?

    Here's the code line of the applet implementation on the index.html
    Java Code:
    <APPLET codebase="classes" code="mysqlConnect/Controller.class" width=425 height=400></APPLET>
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Where is the missing class: com/mysql/jdbc/Driver
    Is it in a jar or do you have a folder structure: classes/com/mysql/jdbc/ that contains the Driver.class file?

    If in a jar, where do you tell the browser the name and location of the jar file?

  13. #13
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    I didn't initialize that .jar file on the browser.
    Ahhh.... I see that problem now....

    How could I solve this thread now?
    Using URLClassLoader?
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  14. #14
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Can you change the html to include the jar file in the archive= attribute

  15. #15
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    Ok... I got a new errror.
    The exception now is:

    Communications link failure
    Last packet sent to the server was 0 ms ago.

    How could I resolve this?
    Last edited by chyrl; 09-23-2010 at 07:34 AM.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  16. #16
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    No idea where that message comes from.
    I don't recognize it as a java programming error.

  17. #17
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,863
    Rep Power
    19

    Default

    Is that the full exception?

  18. #18
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    Is this a firewall issue?
    Last edited by chyrl; 09-23-2010 at 04:20 PM.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  19. #19
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    If I'm going to use firewall tunneling?
    Would this solve my thread?
    Here's the link to the Firewall Tunneling.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  20. #20
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,863
    Rep Power
    19

    Default

    You're not giving us the full information so we can't really advise you.
    What is the full exception you got?

    Is the applet trying to connect to a database on a server other than the one the applet comes from?

Page 1 of 2 12 LastLast

Similar Threads

  1. JApplet on MAC
    By ld_pvl in forum Java Applets
    Replies: 0
    Last Post: 08-23-2009, 01:40 PM
  2. JFrame to JApplet or JApplet to JApplet
    By ramesh.8189 in forum AWT / Swing
    Replies: 13
    Last Post: 02-08-2009, 06:14 AM
  3. Replies: 0
    Last Post: 04-01-2008, 10:17 AM
  4. Replies: 0
    Last Post: 09-28-2007, 12:56 PM
  5. JApplet and html
    By paty in forum Java Applets
    Replies: 1
    Last Post: 08-02-2007, 05:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •