Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Applet Can Coonect To SQL Server Using JDBC ?

  Asked By: Techguy    Date: Oct 13    Category: Java    Views: 1902

Applet Can Coonect To SQL Server Using JDBC ?



9 Answers Found

Answer #1    Answered By: Douglas Sullivan     Answered On: Oct 13
Answer #2    Answered By: Cambria Lopez     Answered On: Oct 13

you can connect to resources i.e. DB, but this is not advices and its not a good practice, try to choose as alternative

Answer #3    Answered By: Topaz Ramirez     Answered On: Oct 13

I think yes of course..Applet is a java code and you can connect to
SQL server  or wut i've tried is to connect to a program which
connect to the SQL server..which is easier I think .

Answer #4    Answered By: Angie Bennett     Answered On: Oct 13

i do not know really cause i did not try before
but i think there some security in running applets that can pervent connection with data base
but i am not sure
you can try and let us know the result

Answer #5    Answered By: Ray Lawrence     Answered On: Oct 13

just be aware applets can only connect to servers which they are downloaded from
it means you should insteall your RDBMS server  (MS-SQL, Oracle, ....) on same server you have installed your Web Server.

Answer #6    Answered By: Chad Bradley     Answered On: Oct 13

Nothing logicaly prevents an Applet to use java.sql.* package.

Answer #7    Answered By: Laurel Collins     Answered On: Oct 13

applet can use java.sql.* package

but applet's can only connect to the server  they come from!
(if you have not defined another custom security policy)
may be the problem of that indian is trying to connect to a sql  server
running on another server.

Answer #8    Answered By: Orville Rodriguez     Answered On: Oct 13

yes, Certainly
and set ODBC for your database then you could easily connect to it.
and if you wanna know more goto this url :
and I attach a pdf for learn more.

Answer #9    Answered By: Bonifaco Garcia     Answered On: Oct 13

I think your problem is about connecting to an SQL server  installed in a
machine other than the one applet  comes from (i.e. codebase machine).

This is from Applets Security FAQ [ http://java.sun.com/sfaq/ ]:

"How can an applet open a network connection to a computer on the

Applets are not allowed to open network connections to any computer,
except for the host that provided the .class files. This is either the
host where the html page came from, or the host specified in the codebase
parameter in the applet tag, with codebase taking precendence.

For example, if you try to do this from an applet that did not originate
from the machine foo.com, it will fail with a security exception:

Socket s = new Socket("foo.com", 25, true);"

there is nothing logically wrong about using Applets JDBC
ability, the above limitation would prevent it.

Solutions are as follows:

1. (Easy way) Install SQL Server on the machine Apple t comes from.
2. (Network way) NAT from codebase machine to the SQL Server Machine
3. (Java way) Overwrite Java's default security with grant files.

If you send the exception you encounter - when trying to connect - we can
help you more.

Didn't find what you were looking for? Find more on Applet Can Coonect To SQL Server Using JDBC ? Or get search suggestion and latest updates.