Applet database connection

I've written an applet that connects to a MS Access database. This applet works fine when run in Appletviewer (with the policy file included). The problem is when I try to run it in a Browser the applet is "not initialized" Can anyone suggest a solution. The point of this applet is to be placed on a web page and it will access the database on the same server. The applet will never have to talk to the machnine it's being run on. Thanks in advance

I just checked the error message in the Java Console and I get the following message.
java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc) at java.security.AccessControlContext.checkPermission(Unknown Source)
the applet simply looks in the database and outputs some text to the browser based on what's in the database. It write nothing to the server or anywhere else. I set up the permissions via a policy file. Is there a way to allow the browser to access the policy file??
for instance in appletviewer I can provide the following
appletviewer -J-Djava.security.policy=policyfile page.htm
where policyfile is the policy file with the appropriate permissions. How can I get the webbrowser to access this file???
thanks again

Similar Messages

  • Signed Applet Database Connection..

    it works in my Test HTML..
    <html>
    <head>
         <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
         <title>Java Applet</title>
    </head>
    <body>
         <p>Applet Test</p>
         <p>
              <applet code="Main.class" archive="flowchart.jar" width="90%" height="90%" alt="Sorry, you need Java to run this Applet">
                   <param name="Username" value="root" />
                   <param name="DatabaseType" value="MySQL" />
                   <param name="Database" value="OQMcontrolec30_validatie_mysql" />
                   <param name="Server" value="192.168.5.4" />
                   <param name="ProcesID" value="72" />
              </applet>
         </p>
    </body>
    </html>it doesn't work on the server..
    <body BOTTOMMARGIN=0 LEFTMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0 SCROLL=no>
    <APPLET code="Main.class" codebase="./" height="100%" width="100%" archive="flowchart.jar">
    <param name="Username" value="root" />
    <param name="DatabaseType" value="MySQL" />
    <param name="Database" value="OQMcontrolec30_validatie_mysql" />
    <param name="Server" value="192.168.5.4" />
    <param name="ProcesID" value="<?=$_GET['id']?>" />
    <br>
    Sorry, your browser doesn't support Java.
    <br>
    </APPLET>I get this for an error in Java Console (using firefox)
    jdbc:mysql://192.168.5.4:3306/OQMcontrolec30_validatie_mysql
    com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: java.security.AccessControlException: access denied (java.net.SocketPermission 192.168.5.4:3306 connect,resolve)
    STACKTRACE:
    java.net.SocketException: java.security.AccessControlException: access denied (java.net.SocketPermission 192.168.5.4:3306 connect,resolve)
         at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
         at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:277)
         at com.mysql.jdbc.Connection.createNewIO(Connection.java:2668)
         at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
         at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
         at java.sql.DriverManager.getConnection(DriverManager.java:582)
         at java.sql.DriverManager.getConnection(DriverManager.java:185)
         at Main.init(Main.java:200)
         at sun.applet.AppletPanel.run(AppletPanel.java:419)
         at java.lang.Thread.run(Thread.java:619)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 157 ms ago.
         at com.mysql.jdbc.Connection.createNewIO(Connection.java:2741)
         at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
         at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
         at java.sql.DriverManager.getConnection(DriverManager.java:582)
         at java.sql.DriverManager.getConnection(DriverManager.java:185)
         at Main.init(Main.java:200)
         at sun.applet.AppletPanel.run(AppletPanel.java:419)
         at java.lang.Thread.run(Thread.java:619)and that sort of repeats itself on every query I do..
    now I've read around the forum that when calling an applet from javascript it isn't trusted.. even when it's signed
    this here is called with PHP.. and I think it isn't trusted either
    how do I make it trusted?
    Edited by: Nizzle on Nov 19, 2007 10:28 AM

    sabre150 wrote:
    Nizzle wrote:
    Yes =)
    I'm pretty sure it has something to do with the applet being "Self-Signed"I don't think so. I use "Self-Signing" without problems like this.it seems that I have a .java.policy file in my userfolder..
    which granted permissions for me on local applet test stuff..
    so now I've removed that the signed doesn't do anything.. anywhere =(
    I signed it like this:
    keytool -genkeypair -dname "cn=TAG Software, ou=TAG Software, o=TAG Software, c=NL" -alias business -keypass w8woord135 -keystore /home/niels/TAGkeystore -storepass w8woord -validity 365
    jarsigner -keystore TAGkeystore -storepass w8woord -keypass w8woord135 flowchart.jar business

  • Applet database connection : access denied

    Connections to my MySql database can only made from applications running on the host. So when I log on to my domain and run a Java application from the console, I can talk to the database. There's no problem with php either. But when I upload an applet, I get an access denied.
    Anyone knows how to get around this problem?

    Change MySQL so that it will accept connections from users running on whatever system the applet is running on.

  • Applet Database Connectivity

    I m trying following code to connect Database within Myapplet
    but class.forName is throwing exception???
    Any idea to remove this problem???
    import java.applet.*;
    import java.awt.*;
    import java.sql.*;
    public class Myapplet extends Applet {
    int width, height;
    Connection con;
    Statement st;
    ResultSet rs;
    public void init() {
    width = getSize().width;
    height = getSize().height;
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection("jdbc:odbc:abc","","");
    st=con.createStatement();
    catch(Exception e)
    //out.println("some problem");
    public void paint( Graphics g )
    }

    You must first check that driver you are using to connect with DB is placed in your class path.
    If driver is not found then Class.forName(); throws exception.

  • Database connection in applet works in Netscape but not in IE

    Hello,
    we have an applet which connects through an jdbc:odbc connection to an Access database.
    When we run it in Netscape 4.7, the applet connects to the database and finds records. When we run it in IE (5.5), we get an error.
    Haven't completely figured out where, but most likely when we try to get the connection:
    con = DriverManager.getConnection(url, "loginname", "password");
    We end up in the catch block.
    Any suggestions what the problem could be?
    TIA
    Gunter

    Can u send me code and let me see.
    Tell me all specification which Access driver you are using and which DSN you are using.
    Let me know i know i can help u out.

  • Database connection an applet

    Hi, I want to do an applet where I can connect to a SQL server via an ODBC. The whole conencting to the database works fine with an application, but access is denied when I use an applet ( ie. I have a separated class that do the databases connections and it failed when I use an applet).
    Somebody told me that I have to create a java.policy file for users and signed the applet with .jar. but I'm not familiar with either signing a jar(I'm not familiar with the .jar at all) and I'm not familiar either with the java.policy file. Can anyone explain this to me plz?

    signed the applet with .jar. but I'm not familiar with either signing a jar(I'm not familiar with the .jar at all)So...., check out the link shown below.
    http://developer.java.sun.com/developer/qow/archive/167/index.jsp
    ;o)
    V.V.
    PS: remember me?

  • How do I get an applet to connect to a database?

    1) I'm working inside a firewall, so only people in my company can see the web server and database server.
    2) My web server has a security certificate installed and SSL is enabled
    3) My java code works fine as an application.
    4) How do I modify my code, my JAR file, my HTML page, or something to get my applet to use the Security Certificate and not throw java.security.AccessControlException?

    tlaford wrote:
    Thank you for your reply.
    1) By a lucky coincidence my database server and my web server are indeed the same machine.Then it should work.
    What that means is that the 'name' you are using for the database does not match the 'name' used for the url requesting the applet.
    The specifics of that are based on what names you are using - and are outside of what I know. However there is some way to get the origination source of the applet. You can either then use that name or at least compare the two (that and your database connect string) to see the difference.

  • Calling one applet from another passing database connection

    We are trying to establish if it is possible to start an applet that connects to a database and use that as a 'menu'. From there we would call other applets. Is there a way to pass along the database connection from one applet to another. Any help is greatly appreciated.
    null

    Here' s a sample program in the Java Tutorial that messages between applets.
    http://java.sun.com/docs/books/tutorial/applet/appletsonly/iac.html

  • How to get database connection in applet

    Hi,
    I am trying to prepare database connection in applet. After preparing connection with database it'll read same values from table.
    At the time of development it works fine. I have used esclipse IDE for coding and testing.
    But when I try to call that applet from browser. It is giving ClassNotFound exception.
    Does anybody know How to get database connection in applet ?
    Please help me if anybody know solution for this.
    Thanks,
    Rajesh

    As per my knowledge is conserned
    1 u can get the database connection in a jsp page and u send the result set as param to the applet and u can use retrieved values as if they were of the same applet if u r interested i can send the db connetion coding for jsp my id [email protected]

  • Applet - Oracle 8.0 database connectivity failing in Netscape Browser

    I have written a Java Applet to connect to the Oracle (8.0) database. My Applet is residing in a remote server. The Applet connected to the database when run in Internet Explorer, but failed to connect to the database using Netscape Navigator (4.08) and resulted in the following error
    java.lang.NullPointerException
    at oracle.jdbc.driver.OracleStatement.get_column_index(Compiled Code)
    at oracle.jdbc.driver.OracleResultSet.findColumn(Compiled Code)
    at oracle.jdbc.driver.OracleResultSet.getInt(Compiled Code)
    at EmpActivityApplet.getActivityData(Compiled Code)
    at EmpActivityApplet.paint(Compiled Code)
    at java.awt.Component.dispatchEventImpl(Compiled Code)
    at java.awt.Container.dispatchEventImpl(Compiled Code)
    * at java.awt.Component.dispatchEvent(Compiled Code)
    at java.awt.EventDispatchThread$EventPump.dispatchEvents(Compiled Code)
    at java.awt.EventDispatchThread.run(Compiled Code)
    at netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(Compiled Code)
    I have zipped the my Java Applet program with the Oracle Thin Driver classes (EmpActivityApplet.zip) and coded the following HTML page to load the Applet:
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
    <TITLE>untitled</TITLE>
    </head>
    <body>
    <applet code="EmpActivityApplet" CODEBASE="." ARCHIVE="EmpActivityApplet.zip"
    WIDTH = 1000
    HEIGHT = 300>
    </applet>
    </body>
    </html>
    Please somebody help me in resolving this problem. This is urgent.
    Please reply to [email protected]
    Regards,
    Raju.

    Hi,
    If ur Applet Needs to Access the System Resouces(JDBC API calls) u have to Make ur Applet trusted.U can Use the Keytool utility Bundled with JDK to Achecive this.The Actual Problem u may get is a Security Exception Due to which u cannot create a Connection Object which results in a Null Pointer Exception
    thankx,
    A.Md Abubacker

  • Database Connection through Applet

    Hello All,
    I want to connect to Access Database through Applet. But I am getting access denied error. How to allow an Applet to connect to the database ?.
    Waiting for reply.
    Thanks and regards,
    Sachin

    I believe it's possible to change the security policy for the java plugin that runs applets, (though I haven't found an appropriate policy file). However, there seems little point in writing an applet that requires that. The whole point of applets is that anyone can run your applets over the net without any special installation. If whoever is going to run your applet has to muck about with security policy files, they'd be a lot better off just running a stand-alone GUI program.
    Even if you signed the applet there would still be the problems associated with having the access file in the right place on the client machine.
    In short you're falling between two stools. Either make the thing a standalone Swing program and install it alongside the database it accesses or do the database access in a web server environment and have the client side obtain the data from the database through http access.

  • Database Connection (JDBC) by Applet

    Hi all,
    I create a database connection from applet ,it worked only compiler means Jbuilder.
    But just after I put it on tomcat It gave error .It didnt work there.It gives follwing error.
    access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc)
    If any one knows the solution please help me.
    Thanks
    Virajchi

    Hi all,
    Dont worry about this question.
    I found the solution.
    Cant load directly Jdbc driver to the applet.
    That directly applet cant communicate with database.
    Cheers,
    Virajchi

  • Problem in getting the database connection from a connection pool

    Hai All,
    I am facing a problem in getting the database connection from a connection pool created on weblogic server 8.1.
    I am using the Oracle database 8.1.7.
    I have configured my connection pool, datasource and JNDI in weblogic.
    In my java program i have the following code to retrieve the connection.
    import java.sql.*;    
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    class jdbcshp1 {
        public static void main(String[] args) {
         Connection connection = null;
         try {
               Hashtable ht = new Hashtable();
               ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");  // Wanna get rid of this.
               ht.put(Context.PROVIDER_URL,"t3://localhost:7001"); // wanna get rid of this.
               // Get a context for the JNDI look up
               Context ctx = new InitialContext(ht);
            javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("myjndi1");
              //Create a connection object
              connection = ds.getConnection();
         The above code is working fine but, the two ht.put statements are creating problem.
    The problem is, after converting the application into WAR file it can be deployed
    on any machine or different port on same machine. My application fails if its deployed on
    weglogicserver which is at different port.
    Is there any way that i can get rid of those ht.put statements or any other way to solve the problem.
    any help is appreciated.
    Thanks in advance
    Pooja.

    Hai All,
    Firstly, thanks for ur reply.
    Even i have seen some code which uses context constructor with out any parameter and works fine.
    i dont understand why its not working for my code.
    When i remove those ht.put code and use context constructor with out any parameter, it giving an error.
    Context ctx = new InitialContext();
    javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("ocjndi");
    connection = ds.getConnection();The error is as follows:
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    the above error is forcing me to include those code but if the port number is changed the code will not work. Plz let meknow if some setting have to be made.
    I appreciate all ur valuable help.
    Thanks once again.
    Pooja.

  • Database Connection Error Cannot create PoolableConnectionFactory

    Hello everyone,
    Background:
    I have a newly installed and configured Ubuntu server running Tomcat5.5 and Mysql 5.0. This server was created in an attempt to migrate from a Red Hat server in a similar configuration, running the exact same webapp. Most of the configuration/classpath differences between the two platforms have been ironed out.
    The Problem:
    When our webapp trys to connect to the database on localhost, an exception 'java.security.AccessControlException: access denied (java.net.SocketPermission localhost resolve)' is generated.
    The server.xml configuration is below:
    <Resource name="jdbc/EconDollarsDB"
    auth="Container"
    type="javax.sql.DataSource"
    username="user"
    password="pass"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/DBName?autoReconnect=true"
    maxActive="20" maxIdle="5"
    />I can connect to the database just fine using the command line client and the same username/password combo. This configuration has been working fine for at least a year on the older server. The only similar problems I have found on the net (meaning the same exception is generated) involve applets and attempts to connect to different hosts. This case involves a webapp, connecting to localhost, using a configuration that is known to work! I am simply baffled.
    The following stacktrace is generated:
    javax.servlet.ServletException: Database Connection Error
    Cannot create PoolableConnectionFactory (Server connection failure during transaction. Due to underlying exception: 'java.security.AccessControlException: access denied (java.net.SocketPermission localhost resolve)'.
    ** BEGIN NESTED EXCEPTION **
    java.security.AccessControlException
    MESSAGE: access denied (java.net.SocketPermission localhost resolve)
    STACKTRACE:
    java.security.AccessControlException: access denied (java.net.SocketPermission localhost resolve)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
         at java.security.AccessController.checkPermission(AccessController.java:427)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
         at java.lang.SecurityManager.checkConnect(SecurityManager.java:1031)
         at java.net.InetAddress.getAllByName0(InetAddress.java:1117)
         at java.net.InetAddress.getAllByName0(InetAddress.java:1098)
         at java.net.InetAddress.getAllByName(InetAddress.java:1061)
         at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:137)
         at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
         at com.mysql.jdbc.Connection.createNewIO(Connection.java:2769)
         at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
         at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
         at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
         at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
         at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
         at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
         at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
         at edu.tamu.erl.database.dblibrary.plugin.TomcatConnectionFactory.getConnection(TomcatConnectionFactory.java:102)
         at edu.tamu.erl.database.dblibrary.DBManager.getConnection(DBManager.java:70)
         at edu.tamu.erl.database.dblibrary.DBManager.getDBDataAccessObjectList(DBManager.java:318)
         at edu.tamu.erl.econdollars.middletire.SessionManager.getSessionStatus(SessionManager.java:157)
         at edu.tamu.erl.econdollars.middletire.SessionManager.retallyDB(SessionManager.java:637)
         at org.apache.jsp.admin.login_jsp._jspService(login_jsp.java:88)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
         at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:50)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)
    ** END NESTED EXCEPTION **
    Attempted reconnect 3 times. Giving up.)
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
         org.apache.jasper.runtime.PageContextImpl.access$11(PageContextImpl.java:65)
         org.apache.jasper.runtime.PageContextImpl$12.run(PageContextImpl.java:766)
         java.security.AccessController.doPrivileged(Native Method)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:764)
         org.apache.jsp.admin.login_jsp._jspService(login_jsp.java:242)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
    edu.tamu.erl.database.dblibrary.DBLibraryBaseException: Database Connection Error
    Cannot create PoolableConnectionFactory (Server connection failure during transaction. Due to underlying exception: 'java.security.AccessControlException: access denied (java.net.SocketPermission localhost resolve)'.
    ** BEGIN NESTED EXCEPTION **
    java.security.AccessControlException
    MESSAGE: access denied (java.net.SocketPermission localhost resolve)
    STACKTRACE:
    java.security.AccessControlException: access denied (java.net.SocketPermission localhost resolve)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
         at java.security.AccessController.checkPermission(AccessController.java:427)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
         at java.lang.SecurityManager.checkConnect(SecurityManager.java:1031)
         at java.net.InetAddress.getAllByName0(InetAddress.java:1117)
         at java.net.InetAddress.getAllByName0(InetAddress.java:1098)
         at java.net.InetAddress.getAllByName(InetAddress.java:1061)
         at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:137)
         at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
         at com.mysql.jdbc.Connection.createNewIO(Connection.java:2769)
         at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
         at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
         at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
         at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
         at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
         at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
         at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
         at edu.tamu.erl.database.dblibrary.plugin.TomcatConnectionFactory.getConnection(TomcatConnectionFactory.java:102)
         at edu.tamu.erl.database.dblibrary.DBManager.getConnection(DBManager.java:70)
         at edu.tamu.erl.database.dblibrary.DBManager.getDBDataAccessObjectList(DBManager.java:318)
         at edu.tamu.erl.econdollars.middletire.SessionManager.getSessionStatus(SessionManager.java:157)
         at edu.tamu.erl.econdollars.middletire.SessionManager.retallyDB(SessionManager.java:637)
         at org.apache.jsp.admin.login_jsp._jspService(login_jsp.java:88)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
         at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:50)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)
    ** END NESTED EXCEPTION **
    Attempted reconnect 3 times. Giving up.)
         edu.tamu.erl.database.dblibrary.plugin.TomcatConnectionFactory.getConnection(TomcatConnectionFactory.java:105)
         edu.tamu.erl.database.dblibrary.DBManager.getConnection(DBManager.java:70)
         edu.tamu.erl.database.dblibrary.DBManager.getDBDataAccessObjectList(DBManager.java:318)
         edu.tamu.erl.econdollars.middletire.SessionManager.getSessionStatus(SessionManager.java:157)
         edu.tamu.erl.econdollars.middletire.SessionManager.retallyDB(SessionManager.java:637)
         org.apache.jsp.admin.login_jsp._jspService(login_jsp.java:88)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)Any help would be greatly appreciated.

    Hi,
    Its clearly saying the connect permission is missing with the current available policy.
    you add the following permisson entry to the <installed JRE>\lib\security\java.policy file.
    (e.g) C:\Program Files\Java\j2re1.4.2_08\lib\security\java.policy
    permission java.security.AllPermission;
    grant{
    permission java.security.AllPermission;
    If the application is running standalone then the code is allowed uncontrolled access but for webapplicatons running through browser, the security check is performed for the configured JRE.
    Regards
    Karthik
    <[email protected]>

  • Database connection pooling with weblogic 8.1.

    Hai All,
    I am new to weblogic database connection pooling.
    I am using Weblogic8.1 and want to use connection pooling to get a jdbc connection. my database server is Oracle 8.1.7.
    Things which i have done using the weblogic admin console.
    I have created a Jdbc connection pool named myconnectionpool.
    I have created a datasource named mydatasource.
    and named the JNDI as myjndi.
    Is the above process correct to create the connection pool in the weblogic8.1.
    I am not aware of the java code to get the database connection object from the connection pool which i have created.
    can any one please let me know the java code to get the connection from the pool.
    Any help is appreciated
    Thanks in advance
    pooja.

    Hai
    I have tried using the code u have mentioned but it returned me
    an error which is below.
    C:\javaexamples\Javaprograms\JDBC>java jdbcexampleconnectionpool
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    I have added the following lines code, which i read in some weblogic documentation. The code i added is below and it worked fine.
    ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    ht.put(Context.PROVIDER_URL,"t3://localhost:7001");
    Context ctx = new InitialContext(ht);I am not sure what the above code does.
    Can anyone let me know what does the above code do.
    Thanks a lot and i appreciate ur help,
    Pooja.

Maybe you are looking for