Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / June 2003

Tip: Looking for answers? Try searching our database.

Applet with mysql

Thread view: 
max - 24 Jun 2003 10:46 GMT
Hi all,

I'm writing simple applet which function to retrieve some info from mysql
database. But the driver I'm using is not suitable, becoz it gave me an
error mesg when the applet run, "No suitable driver". Can anyone please help
me how can I solve this??

Thankyou.

MAx.
Klas - 24 Jun 2003 11:01 GMT
That probably means that you haven't shipped the jdbc driver with your
applet.

/Klas

> Hi all,
>
[quoted text clipped - 6 lines]
>
> MAx.
Robert Klemme - 24 Jun 2003 14:08 GMT
> That probably means that you haven't shipped the jdbc driver with your
> applet.

Even if he did he might run into security problems unless the applet is
signed.  Using JDBC from an applet is IMHO a bad idea.  A better approach
is to to the JDBC work on server side and only transfer results to the
applet (possibly via serialization, RMI or other).

   robert
Klas - 24 Jun 2003 14:54 GMT
Yes, he might run into security problems but note that normally Sockets can
be connected from an applet back to the host where the applet was downloaded
from. So, if your database and your web server are on the same host, you are
in luck. But if your database and webserver are on different machines, you
will need more security privileges. That is standard stuff regarding
applets. And, only the the use of pure Java jdbc drivers will work with
applets. They are fully downloadable and do not require any client-side
configuration.  Use of the jdbc-odbc bridge from an untrusted applet running
in a browser isn't allowed. The jdbc-odbc bridge doesn't allow untrusted
code to call it for security reasons. Odbc is native code, so once odbc is
called the Java programming language can't guarantee that a security
violation won't occur.

The "No suitable driver" is an exception that, most likely, occurs when
calling the DriverManager.getConnection method. This is because you couldn't
load the appropriate jdbc driver before calling the method or if you have an
invalid jdbc url.

I agree with Robert that it might be a bad idea using jdbc from an applet.
Often you want the database to run on a diferent machine than the web server
does. So tunneling the database calls is a better approach and that also
allows you to change the datasource without redistributing the applets.

/Klas

> > That probably means that you haven't shipped the jdbc driver with your
> > applet.
[quoted text clipped - 5 lines]
>
>     robert
Robert Klemme - 25 Jun 2003 17:02 GMT
> Yes, he might run into security problems but note that normally Sockets can
> be connected from an applet back to the host where the applet was downloaded
> from.

Yes, of course.

> So, if your database and your web server are on the same host, you are
> in luck.

Not really since this makes the application highly deployment dependent
and it is generally not good to have db and app server on one machine - at
least if you target for higher server loads.

Apart from that, it does not address the firewall problem.  So your applet
might happily try to connect to the db server, but the firewall might eat
the network packets. :-)

> But if your database and webserver are on different machines, you
> will need more security privileges. That is standard stuff regarding
[quoted text clipped - 5 lines]
> called the Java programming language can't guarantee that a security
> violation won't occur.

An important piece of information.

> The "No suitable driver" is an exception that, most likely, occurs when
> calling the DriverManager.getConnection method. This is because you couldn't
[quoted text clipped - 5 lines]
> does. So tunneling the database calls is a better approach and that also
> allows you to change the datasource without redistributing the applets.

And it can be slow depending on the data to transport and the db vendor's
protocol implementation.  If you restrict the data that has to be sent
over the line by the necessary data, it is likely that performance goes
up.

   robert


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.