• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet Database Connection

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Java. I am trying to create an applet that will run on the Internet. I want someone to be able to enter a userid and then retrieve the data from my SQL Server 7.0 database, return the data for that userid and display it in some text fields in the applet. Now, the thing is that I want to do this without refreshing the page. I can do that with ASP. I got this to work with the jdbc dbc bridge on my machine. But I was told that I should use a type 3 driver. I installed OpenLink's driver but I get errors that I think are just that the client cannot find the driver it needs because of applet security issues. Any code samples you could provide or any other help would be greatly appreciated. Thanks!

[This message has been edited by Paul Wheaton (edited January 25, 2000).]
 
paul wheaton
Trailboss
Pie
Posts: 21896
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(I tried to "disable smilies" in the post so that the "colon oh" didn't get goofy, but oh well)
First! May I humbly suggest that you don't have the applet access the database directly. Odds are good for most apps that the database will end up on a different machine than the web server and then you have to tinker with signing the applet so it can access a machine other than the one that served it up.
Distributed computing! Introduce a middle teir that will run on the same computer as the web server and will talk to the database on behalf of the applet!
Next tip: Is there any way you can avoid using an applet? Applets have lots of headaches and most people are moving away from applets in favor of servlets.
(as a test, let's see if the smiley goes away now that I'm making a new message with smilies turned off: JDBC:ODBC jdbcdbc )
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't servlets do pretty much what ASP does? If so, what is te advantage of Java? I hear everyone talk about it being platform independent but others tell me that is not true. Why would I leave ASP?
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has really become a question for the servlets forum, but I'll have a go at an answer here.
ASP is a way of embedding executable code into web pages. ASP is one of a group of similar technologies including PHP and Java Server Pages (JSP). Servlets are a way of extending the functionality of the server using a full-featured programming language. Servlets are one of a group of similar technologies including FastCGI, NSAPI, ISAPI, Apache modules etc.
Servlets have access to all the power of Java and in particular are not limited to being simple request handlers. Once started, a servlet can exist for as long as the server is running, and keep track of data between requests. Servlets can also use CORBA, RMI or even plain sockets to communicate with other systems, including listening on another port and providing custom services. Servlets are fully multithreaded and can run multiple threads which also span requests if required.
If you need programmatic generation of HTML there are a lot of template systems (I tend to use WebMacro (www.webmacro.org), alternatives can generate HTML by raw code, from XML, from a database and so on.
If you want any more information about any of these, or other aspects of Servlets, feel free to ask in the servlets forum.
 
paul wheaton
Trailboss
Pie
Posts: 21896
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are going to do CGI type stuff, I can't think of anything more portable better engineered than servlets. Go ahead and get a taste and tell me if you think I'm wrong.
As for applets - they are a mess. But! There are times when nothing else will do. So you have to use an applet. Applets are the wart on Java. And Microsoft is trying to infect the wart.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic