Problems In Oracle JDBC Connection through Applet
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Dinkar_Gupta
Posted On:   Thursday, February 14, 2002 01:54 AM

I m using Oracle JDBC drivers for jdbc development .. I used the normal DriverManager method it's giving security exceptions (which is understandable given the sandbox security ),but even after granting Socket Permission to the codebase in .java.policy file. Why so i don't know.. if u can tell please i will be thankful.. I then tried to use the oracle JDeveloper's ConnectionManger API as a workaround .. Here the problem is that when i try to run the jdbc applet on internet explorer having java 1.3 plugin enabled... it doesn't find the connections.properties file...(that is it throws IOException at the instance when i have the folowing code in the init method of applet.. (as shown in java console) /* Con   More>>

I m using Oracle JDBC drivers for jdbc development ..

I used the normal DriverManager method it's giving security exceptions (which is understandable given the sandbox security ),but even after granting Socket Permission to the codebase in .java.policy file. Why so i don't know.. if u can tell please i will be thankful..

I then tried to use the oracle JDeveloper's ConnectionManger API as a workaround ..
Here the problem is that when i try to run the jdbc applet on internet explorer having java 1.3 plugin enabled... it doesn't find the connections.properties file...(that is it throws IOException at the instance when i have the folowing code in the init method of applet..
(as shown in java console)

/*
ConnectionManager cManager = ConnectionManager.getInstance();
Connection conn = cManager.getConnection("OracleConnection")
*/

IOException: Unable to find connections.properties


... the classpath settings are fine..
i even packadged the connections.properties file with the applet class file and used archive attribute of applet tag.. but no avail..

If i run the html file from within JDeveloper by right clicking on it and selecting run in Navigator Window.. is runs it in the applet viewer asks for user name password and connects fine.. no problem.. why so in applet viewer .. and even after selecting save "include password in deployment descriptor" while making connection in connection manager..


Please give a solution... this trivial problem is causing a hell lot of time wastage...

==========================
/* The applet is */
---------------------------
import java.applet.*;

import java.sql.*;

import oracle.jdeveloper.cm.*;


public class AppletWithConnManager
extends Applet
{
private Connection conn;
private Timestamp created = new Timestamp(System.currentTimeMillis());


public void init()
{
try
{
ConnectionManager cm = ConnectionManager.getInstance();
System.out.println("Init(): Getting Connection");
conn = (Connection) cm.getConnection("SCST");
} catch (java.io.IOException e)
{
System.err.println("Init(): IOException: " + e.getMessage());
}
catch (CMException e)
{
System.err.println("Init(): ConnectionManagerException: " + e.getMessage());
}
}
| other code |
| other code |
| other code |
| other code |


public void destroy()
{

try
{
conn.close();
} catch (SQLException e)
{
System.err.println("Destroy(): SQLException: " + e.getMessage());
}
}
}


=================================================================================================.

   <<Less

Re: Problems In Oracle JDBC Connection through Applet

Posted By:   li_fachun  
Posted On:   Wednesday, February 20, 2002 02:41 AM

i think you also need to grant java.io.FilePermission and java.net.NetPermission with requestPasswordAuthentication. do not know whether it will work, have a try.


a suggestion, if you failed once again, recommond u to grant all the permission to the applet, check whether it works. if does work, your program is fine, u only have need to change policy by policytool.


regards.

About | Sitemap | Contact