This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Applets and the fly likes Applet to database problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Applets
Bookmark "Applet to database problem" Watch "Applet to database problem" New topic
Author

Applet to database problem

Suresh Shanmugam
Greenhorn

Joined: Mar 03, 2004
Posts: 11
The problem is.

Developed a JApplet, changed the security ( java.policy ), works fine in the applet viewer,

tested with IE (running the applet but, on conneting to the database directly (As per instructions) During getConnection() call throwing :
--------------------------------------------------------------------------------------------------------------------------
com.inet.tds.SQLException: access denied (java.net.SocketPermission 10.0.0.1:1433 connect,resolve)
java.security.AccessControlException: access denied (java.net.SocketPermission 10.0.0.1:1433 connect,resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.inet.tds.k.a(Unknown Source)
at com.inet.tds.k.if(Unknown Source)
at com.inet.tds.k.<init>(Unknown Source)
at com.inet.tds.k.a(Unknown Source)
at com.inet.tds.TdsDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at SearchDataApplet$SearchData_ATest.getConnection(SearchDataApplet.java:1755)
at SearchDataApplet$SearchData_ATest.runQuery(SearchDataApplet.java:1983)
at SearchDataApplet$searchButtonListener.actionPerformed(SearchDataApplet.java:1443)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
----------------------------------------------------------------------------------------------------------------------------

With Netscape 4.7 ( ClassFormatError)
------------------------------------------------------------------------------------------------

Both browsers have java 1.4 Plugin,

TYPE 4 Driver, MS SQL Server,
-----------------------------------------------------------------------------------------------------------


why this is not working even after the applet is signed??

SQL Server is @ 10.0.0.1 Default port 1433
--------------------------------------------------------------------------------------------------------------------

please do me something ,to make it happen
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
Hi Suresh
Make sure that the correct java.policy is getting applied. To do that, see what JRE (the path to the JRE in your local system) is being used by IE's JRE. You can know this from the Java console when you print all system properties. Now, if that JRE folder is different than the one you applied java.policy then it would not work.
e.g. When you use appletviewer you know that you are using,
c:\j2sdk1.4.2\
and you modified java.policy in c:\j2sdk1.4.2\jre\lib\security BUT IE is using c:\Program Files\Java\j2re1.4.2 then it won't work as the java.policy in the j2re1.4.2\lib\security would get applied from IE..
Best way for java.policy configuration is the "user home" I guess. So you have to put .java.policy (notice . in beginning) in the user home directory (e.g. C:\Documents and Settings\maulin\)..

See if any of these changes works ..
First it works in IE then we can deal with Netscape 4.7 (though I wonder why one have to use Netscape 4.7 in presence of Mozilla/Firefox )...
Regards
Maulin
Suresh Shanmugam
Greenhorn

Joined: Mar 03, 2004
Posts: 11
Hi maulin,
Thats a wonderful suggestion from u.
yes I've done that mistake but, even after changing the policy files under Progra~1/java its not working.
You should note that my applet is signed.
Even after signing y its throwing the exception?

Regards,
Suresh.S
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
Hi Suresh
Can you put that applet on the web where I can access by my browser?
I will try to see if I can load the applet..
Regards
Maulin
Suresh Shanmugam
Greenhorn

Joined: Mar 03, 2004
Posts: 11
Maulin,
I dont think its possible..
Instead I'll send u the file
 
wood burning stoves
 
subject: Applet to database problem