Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Applet to database problem

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maulin,
I dont think its possible..
Instead I'll send u the file
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic