Hello all and thanks to all that try to help me.
Here is my case. I am working on Project for a Java programming class.
I have created some JDBC applications that query a MySQL database and
they work perfectly when i run them through appletviewer as JApplets,
or as JFrame. The only problem is that when i attempt to run them from
the browser I get an error message something like "Database driver
cannot be found" . Im pretty sure that this is a security issue with
the browser not allowing the applet access the database driver
directly. My project is a website that uses MySQL as a backend, so i
really need to run my applications on a browser.
So my question is how can i run my applications on a Browser? Do I
have to install a web server such as apache?
>Hello all and thanks to all that try to help me.
>
>Here is my case. I am working on Project for a Java programming class.
>I have created some JDBC applications that query a MySQL database and
>they work perfectly when i run them through appletviewer as JApplets,
Applets are a lot more difficult to debug and deploy
than applications.
>or as JFrame. The only problem is that when i attempt to run them from
>the browser ...
URL? Where can we visit this problem applet?
>..I get an error message something like "Database driver
>cannot be found" .
Something like? Please don't waste your time and our
bandwidth with errors that are 'something like' what is
happening. Always be very specific, and then state
along the lines of 'the error *is*..'.
>...Im pretty sure that this is a security issue with
>the browser not allowing the applet access the database driver
>directly.
Most likely. What is the applet element in the web page of
the URL you had not mentioned? What errors are reported
in the Java console?
>..My project is a website that uses MySQL as a backend, so i
>really need to run my applications on a browser.
That is not true. An application, or a web started application or
applet, can also access the information or DB on the web site.
While the application itself is difficult to load from a web page,
a web start application is simplicity itself - and probably a better
approach to the entire 'remote user access DB' problem.
Here is an example of a web started application/applet.
<http://www.physci.org/jws/#jtest>
>So my question is how can i run my applications on a Browser?
Start by answering the questions above, there is not
enough information yet, to tell for sure.
>..Do I
>have to install a web server such as apache?
No. If the problem is as we suspect, it is simply a matter
of ensuring the DB and applet codebase* is the same server.
* All the jar's for the code and drivers.

Signature
Andrew Thompson
http://www.athompson.info/andrew/
yup. you need to download a JDBC driver and install it in the
classpath of the JVM your browser is using. sounds like the browser
might be using a different JVM.
(the other guy responding is an a.s -- he knows the answer, and your
question was adequate to identify the problem)
> "Database driver
> cannot be found"
Lew - 24 May 2007 13:22 GMT
> yup. you need to download a JDBC driver and install it in the
> classpath of the JVM your browser is using. sounds like the browser
[quoted text clipped - 5 lines]
>> "Database driver
>> cannot be found"
Please do not top-post.
Are you sure? Doesn't the driver sit on the /server/ side, and is thus
completely independent of the browser? How the heck can having a JDBC driver
download affect anything?
I am no applet expert - for this kind of question Andrew Thompson has the best
knowledge.
Oh, Christopher - Andrew is not an a.s. By telling the OP that you are
cutting them off from arguably their best source of information in this forum.
Who is the a.s, someone helping the poster or someone poisoning the OP's
mind against that help and providing incorrect information?
To the OP - I suggest that you follow Andrew's suggestions. They will help you.
Andrew suggested:
> No. If the problem is as we suspect, it is simply a matter
> of ensuring the DB and applet codebase* is the same server.
> * All the jar's for the code and drivers.
I think this answer is probably correct and Christopher's was just blowing
smoke up your, but Andrew would know.

Signature
Lew
Arne Vajhøj - 27 May 2007 04:33 GMT
> Are you sure? Doesn't the driver sit on the /server/ side, and is thus
> completely independent of the browser?
The original post strongly indicated that the JDBC code was client side.
Arne
Andrew Thompson - 27 May 2007 08:11 GMT
>> Are you sure? Doesn't the driver sit on the /server/ side, and is thus
>> completely independent of the browser?
>
>The original post strongly indicated that the JDBC code was client side.
We can guess all day and night. Until the OP answers
my first (and preferably subsequent) questions, I would
prefer to spend my time on problems for which the
necessary information is available to debug the problem.
For clarification - ultimately the driver code needs to be
available to the client. There are a number of ways to
ensure that.
You might take the approach used by the JMF installer -
which copies the relevant Jar's into the lib of every single
JRE it can find. Those jar's are then not only available
to the application, but also any other application that uses
the JRE - if newer JRE's are installed, the installer needs to
be run again.
OTOH - it is much simple for an applet* to provide the jar
containing the driver classes, specified** in the archives
attribute of the applet element.
This ensures the drivers are available to the applet in
whatever JRE it runs, but are not put on the classpath
of other applications, needlessly.
* or application/applet launched using web start
** ..in the jar element within the resources element.

Signature
Andrew Thompson
http://www.athompson.info/andrew/
Arne Vajhøj - 27 May 2007 19:29 GMT
>>> Are you sure? Doesn't the driver sit on the /server/ side, and is thus
>>> completely independent of the browser?
>> The original post strongly indicated that the JDBC code was client side.
>
> We can guess all day and night.
If you think it is guessing to think:
#I am working on Project for a Java programming class.
#I have created some JDBC applications that query a MySQL database and
#they work perfectly when i run them through appletviewer as JApplets,
#or as JFrame. The only problem is that when i attempt to run them from
#the browser I get an error message something like "Database driver
#cannot be found" .
is client side not server side Java, then I think you have a problem !
Arne