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]

Similar Messages

  • How to get database connection in common java class

    hi friendz,
    plz help me...
    I am using JDEV 11.1.2.2.0 version.
    my problem is I'm writing common java class which can reuse any application.
    in this case when im create database connection like this,
    String username = "a";
    String password = "b";
    String thinConn = "jdbc:oracle:thin:@IP:1521:database";
    DriverManager.registerDriver(new OracleDriver());
    Connection conn =
    DriverManager.getConnection(thinConn, username, password);
    conn.setAutoCommit(false);
    return conn;
    but this statement not working in java class.its working only backing bean.
    import oracle.jdbc.OracleDriver;
    DriverManager.registerDriver(new OracleDriver());
    how can i do that??
    hope your help
    -Harsh-

    What is the error message in Java class?
    With JDBC 4.0 driver the DriverManager class has added support for the Java SE Service Provider mechanism to the getConnection() and getDrivers() methods using which JDBC drivers may be loaded automatically. The following Class.forName() method is not required to be invoked.
    Class.forName(“oracle.jdbc.OracleDriver”);
    Only the following is required to obtain a connection.
    String url="jdbc:oracle:thin:@localhost:1521:ORCL";
    Connection connection = DriverManager.getConnection(url,"oe", "pw");

  • How to get (database) connections for building an extension in 11g?

    Hi,
    I have built an extension for jdeveloer/sqldeveloper and I used the ConnectionManager Class to start my dockable.
    Having migrated from Jdev10g to 11g it looks like that the ConnectionManager class was removed, at least I'm
    not able to locate it anymore.
    I've provided the source code below, to show how I used to work with the class.
    String connectionNames[] = ConnectionManager.getInstance().getConnectionNames();
    DatabaseConnections.getInstance();
    ... Loop ...
    if (i >= connectionNames.length)
    break;
    String name = connectionNames;
    if (name.equals(dockableId))
    ... Start dockable...
    What is the supported way to work with connections in 11g?
    Best regards,
    Ingo

    Hi,
    thanks for the quick response. Seems that my extension project in Jdev 10g was messed up by putting the new sqldevloper.jar in the class path. I've migrated to Jdev11g and the missing class is found.
    Where I'm lost right now is the way to get a connection from the pool. Most of the classes that I used for that (oracle.jdeveloper.cm.dt.ConnectionNode, oracle.jdeveloper.cm.dt.DatabaseConnectionNode;)
    are not longer existing and it looks like there is a new way to achieve this in Jdev11g.
    Is there a documentation available somewhere, where the "new" strategy is explained?
    Best reagards,
    Ingo

  • SUN JES 8.1 Q2UR2: Long time taken in getting database connection.

    Application server registered intermittent slowness in getting database connection from javax.sql.DataSource. Based on the following JMX value, the application servers still haven�t reached the threshold. Its identified the slowness was due to application server performing validation (select count(*) from dual).
    Sample code:
    ds.getConnection(username, password); // where DS is the javax.sql.DataSource
    Network
    It is observed that the bi-directional ping stats showed that the response time < 1.19 ms. Network Switch port utilisation was <30% and there were no errors and collision detected.
    Database
    Based on oracle database statspack, it showed that the database is healthy. On top of that, the following query was scheduled to be executed every second to monitor Select count(*) from dual elapsed time.
    select sess.sid, sess.serial#, sess.client_info, sess.program, sql.sql_text, sql.elapsed_time from V$SESSION sess, V$SQL sql where sess.sql_hash_value=sql.hash_value and upper(sql.sql_text) like 'SELECT COUNT(*) FROM DUAL' order by sess.sid
    Basically this query will capture the cumulative elapsed time per session id. This query is able to caption �Select count(*) from dual� that ran more than 2 seconds.
    Example 1 � how the cumulative elapsed time registered in the log:
    2006_11_02_16_53_55,Connection 1, SID 1 perform a select count(*) from dual. Oracle registered elapsed time 10 ms.
    2006_11_02_16_53_55,Connection 2, SID 2 perform a select count(*) from dual. Oracle registered elapsed time 10 ms.
    2006_11_02_16_54_57,Connection 1, SID 1 perform a select count(*) from dual. Oracle registered elapsed time 20 ms.
    2006_11_02_16_54_58,Connection 1, SID 1 perform a select count(*) from dual. Oracle registered elapsed time 30 ms.
    2006_11_02_16_54_58,Connection 2, SID 2 perform a select count(*) from dual. Oracle registered elapsed time 20 ms.
    Example 2 � If query ran more than 2 sec:
    2006_11_02_16_53_55,Connection 1, SID 1 perform a select count(*) from dual. Oracle registered elapsed time 10 ms.
    2006_11_02_16_53_57,Connection 1, SID 1 perform a select count(*) from dual. Oracle registered elapsed time 20 ms.
    2006_11_02_16_54_57,Connection 1, SID 1 perform a select count(*) from dual. Oracle registered elapsed time 2030 ms. << if query that ran more than 2 secs, there will be a sudden jump of 2 secs in the subsequent cumulative elapsed time.
    Previously based on jmx log, it do registered 10k connections was acquired in 1 second and only 6 active connections was used. If same connection was used and on the same second, the cumulative elapsed time will registered in the log. The longest elapsed time that registered in 2 Nov 2006 01:00 pm to 05:00 pm logs was 800 ms but long get database connection still registered 5 to 7 seconds.
    Questions:
    1) Is it possible that I can use dtrace to capture the bottleneck?
    System information:
    Oracle:
    DriverVersion: [10.2.0.1.0]
    DriverMajorVersion: [10]
    DriverMinorVersion: [2]
    DriverName: [Oracle JDBC driver]
    URL: [jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST= (ADDRESS=(PROTOCOL = TCP) (HOST = XXXXXX) (PORT = 1524)) (ADDRESS=(PROTOCOL = TCP) (HOST = XXXXXX) (PORT = 1524))) (CONNECT_DATA = (SID = CP_P)) (source_route=yes))]
    UserName: [CP_P1]
    Database Product Name: [Oracle]
    Database Product Version: [Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.6.0 - Production]
    Database Product Major: [9]
    Database Product Minor: [2]
    Drivers: Type 4
    JDK
    JDBC Major: [10]
    JDBC Minor: [2]
    The JDK version is 1.5.0_02
    SUN JES Application Server
    Sun Java System Application Server Enterprise Edition 8.1_02 running under solaris 10

    Massive Crossposting:
    http://forum.java.sun.com/thread.jspa?threadID=790473&messageID=4491822#4491822
    http://forum.java.sun.com/thread.jspa?threadID=790472&messageID=4491819#4491819
    http://forum.java.sun.com/thread.jspa?threadID=790471&messageID=4491817#4491817
    http://forum.java.sun.com/thread.jspa?threadID=790470&messageID=4491816#4491816
    http://forum.java.sun.com/thread.jspa?threadID=790469&messageID=4491815#4491815
    http://forum.java.sun.com/thread.jspa?threadID=790468&messageID=4491814#4491814
    http://forum.java.sun.com/thread.jspa?threadID=790466&messageID=4491812#4491812

  • When and How to close database connection in JSP?

    Hi there,
    I am using MySQL and JDBC 3.0, in my system, When and How to close database connection in JSP?
    Thanks in advance.
    Lonely Wolf
    <%@ page session="true" language="java" %>
    <jsp:include page="checkauthorization.jsp" />
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    <%--
    Execute query, with wildcard characters added to the
    parameter values used in the search criteria
    --%>
    <sql:query var="availablecomputerList" dataSource="jdbc/Bookingcomputer" scope="request">
    SELECT * FROM computer where status=0
    order by s_code
    </sql:query>
    <html>
    <head>
    <title>Search Result</title>
    </head>
    <body bgcolor="white">
    <center>
    <form action="checkin.jsp" method="post">
    <input type="submit" value="Back to Check-in Page">
    </form>
    <c:choose>
    <c:when test="${availablecomputerList.rowCount == 0}">
    Sorry, no available computer found.
    </c:when>
    <c:otherwise>
    The following available computers were found:
    <table border="1">
    <th>Computer</th>
    <th>Description</th>
    <th>Status</th>
    <c:forEach items="${availablecomputerList.rows}" var="row">
    <tr>
    <td><c:out value="${row.s_code}" /></td>
    <td><c:out value="${row.description}" /></td>
    <td><c:out value="${row.status}" /></td>
    </tr>
    </c:forEach>
    </table>
    </c:otherwise>
    </c:choose>
    </center>
    </body>
    </html>

    when should you close the connection? when you're done with it.
    how should you close the connection? like this: conn.close();
    that said, doing this in a JSP page is bad form and not recommended
    JSP's typically don't contain ANY business or data logic

  • How to get datbase connection in Struts

    I m not getting database connection while entering the data into database. can you provide any help for that please its very urgent

    [Click here|http://catb.org/~esr/faqs/smart-questions.html#urgent]
    db

  • Hey there! well i from india and i m facing problem connecting my debit card to the itune store ,as the very option is not there, can someone guide me how to get it connected , i have a mastercard debit card with me .please help me

    hey there! well i from india and i m facing problem connecting my debit card to the itune store ,as the very option is not there, can someone guide me how to get it connected , i have a mastercard debit card with me .please help me

    if you are signed in to iTunes with your AppleID, click on the AppleID > view account > payment information > enter in your information

  • Why is the data source not getting database connection without  exception?

    experts,
    I am trying to config server.xml to get database connection. i am now getting no exception duing the connection, but the returned connection is NULL, why? thanks/ this is my codes:
    public synchronized Connection getConnection()
    try{
    Context ctx = new InitialContext();
    if (ctx == null)
    throw new Exception("Context is null");
    Context initContext = new InitialContext();
    Context envContext = (Context)initContext.lookup("java:/comp/env");
    DataSource ds = (DataSource)envContext.lookup("test");
    Connection conn = ds.getConnection();
    }catch(Exception ex)
    ex.printStackTrace();
    return conn;
    }

    Remove the first slash after "java:".
    Context envContext =(Context)initContext.lookup("java:comp/env");

  • I have just purchased Apple TV today everything works fine on my TV but I don't no how to get it connected to my ipad or I phone

    I have just purchased Apple TV today everything works fine on my TV but I don't no how to get it connected to my ipad or I phone

    Welcome to the Apple Community.
    Assuming both devices are on the same network and that AirPlay is not turned off on the Apple TV, then simply tap on the screen when you are watching content you wish to stream to your Apple TV, then tap the airplay icon that appears in the control bar, choose the Apple TV from the menu that appears.
    When displaying the content you wish to mirror on the iPad 2 (or better), iPad Mini, iPhone 4S (or better), double tap the home button (quickly) and swipe the bottom row of apps to the right to reveal the playback controls, tap the AirPlay icon and select your Apple TV from the list of available devices.

  • How to get "consolidator connections" in the Navigator

    Greetings,
    My problem is with oracle 8i lite as follows:
    I never got in the navigator the "consolidator connections"
    I only get on the left of the screen of the navigator
    -"databases"
    -"connections"
    So my question is:
    How can i get my navigator with the "consolidator connections"???
    Please answer ma as soon as possible.
    Thanks a lot
    Haitham Foda
    null

    In order to have the consolidator folder show up in the Navigator, copy the "CONSOLIDATOR20" and "CONSOLIDATOR_HOME" Key from your "ORACLE" registry to your "HOME1" registry

  • 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.

  • How to get current connection from ejb container

    We have to execute sql statement directly to the database and will use for this issue to connection establish between the ejb container and the database.
    How to get the corresponding object ?

    thanks

  • How create a database connection only one for lot of AM

    Hi ,
    In My Application am having lot of Application module its containing database connection per AM its connecting to same database only if i want to make it unique connction how i can proceed. which is correct way any one can help me
    Thanks
    Prabeethsoy

    The source trace show how the JUApplication was created and saved to BindingContext.
    1. private static void invokeBeginRequest(
    BindingContext bindingCtx, HashMap requestCtx)
    Object obj;
    Iterator iter = bindingCtx.valuesIterator();
    while (iter.hasNext())
    obj = iter.next();
    if (obj instanceof DCDataControlManagement)
    2.First type is DCDataControlReference ====> ((DCDataControlManagement)obj).beginRequest(requestCtx);
    3. ADFBindingFilter chain.doFilter(request, response);
    4. DCDataControl control = actionBinding.getDataControl();
    5. JUCtrlActionBinding
    public final DCDataControl getDataControl()
    if (mDataControl == null)
    if (getDef() instanceof JUCtrlActionDef )
    String name = ((JUCtrlActionDef)getDef()).getDataControlName();
    if (name != null && getBindingContainer() != null)
    BindingContext ctx = getBindingContainer().getBindingContext();
    if (ctx != null)
    6. ========>mDataControl = ctx.findDataControl(name);
    if (mDataControl == null)
    if (getIteratorBinding() != null)
    mDataControl = getIteratorBinding().getDataControl();
    else if (getBindingContainer() != null)
    mDataControl = getBindingContainer().getDataControl();
    return mDataControl;
    7. BindingContext
    public DCDataControl findDataControl(String name)
    return (DCDataControl)get(name);
    public Object get(Object key)
    Object rtn = mDCMap.get(key);
    if (rtn == null)
    rtn = mBCMap.get(key);
    else
    if (rtn instanceof DCDataControlReference)
    // remove the reference in order to prevent re-entrancy.
    remove(key);
    *8. Create JUApplicaion======> rtn = ((DCDataControlReference)rtn).getDataControl(this);*
    *9. save JUApplication with AM ======>  put(key, rtn);*
    return rtn;
    10. DCDataControlReference
    public DCDataControl getDataControl(BindingContext ctx)
    String name = getName();
    DataControlFactory factory;
    try
    Class factoryClass = JBOClass.forName(mDef.getFactoryClass());
    factory = (DataControlFactory)factoryClass.newInstance();
    catch(Exception e)
    throw new JboException(e);
    // JRS this is a backwards compatibility step. The generic
    // DataControlFactoryImpl used to perform this mapping such
    // that the bean class will be faulted back the definition class
    // if null. I am performing this mapping at RT only in order
    // to maintain the DT integrity (i.e. I don't want the DT to start
    // faulting the bean class as the definition class when writing the
    // DC def).
    if (mDef.getBeanClass() == null)
    mDef.setBeanClass(mDef.getDefinitionClass());
    *11. create JUApplicaion =====> DCDataControl dc = (DCDataControl)factory.createSession(*
    ctx, mDef.getName(), mUserParams, mDef);
    SessionContext sessionCtx = ctx.getSessionContext();
    if (sessionCtx != null)
    dc.setSessionContext(sessionCtx);
    // fire the deferred beginRequest notication on the new datacontrol
    if (mRequestContext != null)
    12.======>dc.beginRequest(mRequestContext);
    mRequestContext = null;
    return dc;
    }

  • How to manage database connections

    Hi, I have been trying to find the best way of doing database connections, My application will not be used by many users since its an intranet application used by administrators only to change settings.
    I want to be able to connect to db from a servlet but not have to make the connection all the time, I was thinking of creating my own ContinuousConnection class which basically keeps the connection and all you do is getConnection which checks if the connection is "up" or not, if it is up then just give it as the return value else, just create a new connection since the driver class has already been loaded...if it is null then just load the driver and make the connection.
    this way in differenet functions that i have in the servlet dont have to make connections all the time.
    Is there a better way of doing this?
    I was thinking of putting the connection object in the data section of the servlet, but then it is more or less like static data amongst all threads created to run the servlet and I dont know what would happen if 2 querries are run from the same connection by different serving threads...can someone please explain me this..
    I know a good way of managing connections is using a pool..but i dont know how useful is that here...also i am not very familiar with a pool..can someone please explain me the idea behind it..and how it works...that would be just perfect.
    Thank you very much.
    Ankur

    IIRC to setup tomcat connection pooling when using an Oracle database (for example):
    Add something like this to the server.xml file:
            <Context path="/myProject" docBase="myProject" debug="0"
                     reloadable="true" crossContext="true">                
                    <Resource name="jdbc/ORAC" auth="Container" type="javax.sql.DataSource"/>
              <ResourceParams name="jdbc/ORAC">
                <parameter>
                  <name>factory</name>
                  <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                </parameter>
                <parameter>
                  <name>driverClassName</name>
                  <value>oracle.jdbc.driver.OracleDriver</value>
                  </parameter>
                <parameter>
                  <name>url</name>
                  <value>jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:XXXX</value>
                </parameter>
                <parameter>
                  <name>username</name>
                  <value>xxxxx</value>
                </parameter>
                <parameter>
                  <name>password</name>
                  <value>xxxxx</value>
                </parameter>
                <parameter>
                  <name>removeAbandoned</name>
                  <value>true</value>
                </parameter>
                <parameter>
                  <name>logAbandoned</name>
                  <value>true</value>
                </parameter>
                <parameter>
                  <name>maxActive</name>
                  <value>20</value>
                </parameter>
                <parameter>
                  <name>maxIdle</name>
                  <value>10</value>
                </parameter>
                <parameter>
                  <name>maxWait</name>
                  <value>-1</value>
                </parameter>
              </ResourceParams>                       
            </Context>  This needs to go in between the <Host> ... </Host> tags (probably at the bottom) in the server.xml file (${CATALINA_HOME}/conf). You must put this in the correct place in the xml file or you'll get errors.
    Then you need to add this to your web.xml file:
        <resource-ref>
             <description>Oracle Datasource</description>
             <res-ref-name>jdbc/ORAC</res-ref-name>
         <res-type>javax.sql.DataSource</res-type>
         <res-auth>Container</res-auth>
        </resource-ref>Again this needs to go in the correct place (as per the dtd)
    Then to get a connection:
    final Context initContext = new InitialContext();               
    final DataSource ds = (DataSource) initContext.lookup("java:/comp/env/jdbc/ORAC");                              
    final Connection conn = ds.getConnection();You probably want to wrap getting these connections in a class (i.e. with a getConnection method). And remember to close the connections when you've finished with them.

  • How to configure database connectivity in OC4J App server.

    Hi,
    I am working on Oracle ESB flows. I have the flow inserting rows into database table using database connection that I have defined. I havent set up connection settings in OC4J EM console.
    I dont wonder when JDeveloper is inserting rows into tables, as connection is explicitely defined in JDeveloper.
    Now I login to EM enviroment and click on Home, click on Web Services tab, and when I use this flow as a Web Service end point and feed values through the form that it provided, it also works. But since I havent defined any connection properties in App Server explicitely, I wonder where is it getting connection properties(JNDI name) from.
    I want to configure some settings in Testing Environment and am kind of stuck at this point.
    Thanks,

    Hi.
    When you don't have JNDI configured, OC4J uses the design time connection defined in the Adapter's WSDL. Look for the following description in your Adapter WSDL:
    <!-- Your runtime connection is declared in
    J2EE_HOME/application-deployments/default/DbAdapter/oc4j-ra.xml
    These 'mcf' properties here are from your design time connection and
    save you from having to edit that file and restart the application server
    if your JNDI is missing.
    These 'mcf' properties are safe to remove.
    -->
    Now, for JNDI configuration, you can use the SOA Suite tutorial as a reference:
    http://download.oracle.com/docs/cd/B31017_01/core.1013/b28937/setting_up.htm#CIHBHEFC
    There you can find the steps to create a connection pool, data source, etc.
    Denis

Maybe you are looking for