This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Applets / JDBC never the twain to meet?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.

Let me start by writing that I am new to Java which might explain my question.

I am looking to write a java applet that reads from a Access database table located on the same server. The applet reads the table and creates a formated family tree. The applet can also write new entries into the table.

I know about security exceptions during runtime - but is such a thing possible? That is to say if I upload the html page with the applet on it - can the applet happily read and write to the database if I set up permissions and so forth at the start and then just leave it?

If such an apparently straight foward way of creating my family tree thing is not possible - what would be the next most likely solution?

I would appreciate any advice to point me in the right direction..

Thanks All.
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Access requires an ODBC connection to be set up (in order for the JDBC/ODBC bridge to work), and I'm fairly certain that you can't do that over a TCP/IP network, through firewalls and all.

It might work if all machines running the applet (and the server with the Access DB) are on the same network, though.
[ June 29, 2007: Message edited by: Ulf Dittmer ]
 
author & internet detective
Posts: 40035
809
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephen,
Welcome to JavaRanch!

While this question is on topic in both JDBC and Applets, I find people in the Applets forum know more about this stuff. I'm going to move your question there so you can get more responses.
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only way I know of doing so is to pass the information to a servlet on the server, and let the servlet do the work. There are a ton of examples on the 'net, but the one I followed was here:
http://www.frank-buss.de/echoservlet/

Basically all this example does is takes a string, sends it to the servlet, and the servlet sends it back. I modified it to take a string as a parameter, query a database using that parameter, and return an arraylist to the applet. What ever you decide to return to the applet has to be serializable, otherwise it will not work properly.

I don't know if there is any more straight forward of a way to do it. IMHO, I would not want my applet to have direct access to my database anyway. I would want something on the server to make sure that the data was valid (not an attempt at SQL injection, etc), and just let the applet handle the display portion.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To Chad Clites:

I totally agree with you.

I am a newbie too.

Now I am involved in a Project which was designed to use applet in client side,and let servlet handle data communication.

But I am not clear why you said "What ever you decide to return to the applet has to be serializable, otherwise it will not work properly."Could you please explain more?

I also doubt about why people like to use applet embeded in HTML page, because it could code event-drived likely?

Frankly to say, My first java class is about applet, Although i am not good at it now, I just like it.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic