• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Java Applet and MySQL on Web Site

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Is it possible to create a Java applet that access data stored in a MySQL database. Both the Java applet and the database would be hosted on the same server.

If it is possible, can anyone recommend any good resources to get me started?

Derek
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, you could, but to do so, you'd have to have your MySQL database listening for connections on the network without a firewall. If this is an intranet app, that may be OK, but it's it's an Internet application, that's not a very smart idea. A better architecture would have a servlet that talked to the database, and provided the data the applet needed.

Anyway, as far as resources to get started: you'll want to read Sun's JDBC Tutorial as a first step.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might want to take a look at this thread that I posted about 2 years ago. I was able to run an applet that accessed a MySQL DB on the same server as the web server.

Ernest is correct with what he says. That is the proper way to do it, but if you need to get by, it can be done.

On that note, I would second guess the need for an applet. Unless you have need for some pretty fancy GUI elements or this is for a class and an Applet is required, I would definatly look into a Web Application design instead of an Applet.
 
Derek Etnyre
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you both for the advice.

I will check into servlets and rethink my strategy.

Derek
 
"I know this defies the law of gravity... but I never studied law." -B. Bunny Defiant tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic