Lot of DataBase connections

Hi,
I am using OC4J as web container and Oracle 8i database on Sun solaris. I am using following scheme to access database connection.
I have one Properties file that carries information about the driver,url,user and password
I have one class RDBMServices. In constructor I reads that properties file. I have one getConnection method that setup connection Following is the code
* Gets a database connection
* @return a database Connection object
     public static Connection getConnection()
     Connection conn = null;
          try
               Class.forName (sJdbcDriver);
conn = DriverManager.getConnection (sJdbcUrl, sJdbcUser, sJdbcPassword);
          catch ( Exception e )
          System.out.println(e);
          return conn;
I also have one method that is used to release connection.
* Releases database connection
* @param a database Connection object
     public static void releaseConnection (Connection con)
          try
if (con != null)
          con.close();
          catch ( Exception e )
Ok now in every JSP page where I need database access, I just create object of RDBMServices and execute queries on it. When I am done then I just call releaseConnectio() method to release that connection. So I am doing this in every JSP page. My problem is that I have lots of database connection open eventhoug I am releasing connection. For example I ran 50 users test and they Open 150 connection becasue every user goes through three pages. Please help me how I can get rid of this problem. THANKS
Faizan

This example demonstrates how to configure a JDBC source and how to make a
JNDI lookup to access it. This example assumes you are using the scott database
user and EMP table exists in SCOTT schema.
1. Create an new entry in the $J2EE_HOME/config/data-sources.xml file as
follows. Make appropriate changes to the connection information.
<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="OracleDS"
location="jdbc/OracleDS"
xa-location="jdbc/xa/OracleXADS"
ejb-location="jdbc/OracleDS"
connection-driver="oracle.jdbc.driver.OracleDriver"
username="scott"
password="tiger"
url="jdbc:oracle:thin:@localhost:1521:ORCL"
inactivity-timeout="30"
/>
2. The following Servlet (GetDSUsingJNDI.java) demonstrates how to make a
JNDI lookup to retrieve a JDBC data source named "jdbc/OracleDS".
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import javax.naming.*;
import java.sql.*;
import javax.sql.*;
public class GetDSUsingJNDI extends HttpServlet {
InitialContext context = null;
DataSource jdbcURL = null;
Connection conn = null;
public void init(ServletConfig config) throws ServletException {
super.init(config);
// Obtain connection using JNDI Lookup
try {
context = new InitialContext();
jdbcURL = (DataSource) context.lookup("jdbc/OracleDS");
catch(NamingException e)
throw new ServletException("Error looking Data Source", e);
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = new PrintWriter (response.getOutputStream());
out.println("<html>");
out.println("<head><title>Getting Data Source using JNDI Lookup</title></head>");
out.println("<body><H1>Getting Data Source using JNDI Lookup</H1>");
// Connect to the database
try {
Connection conn = jdbcURL.getConnection();
out.println("Connected to database successfully ..");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT ename FROM emp");
out.println("Results of the query");
// Display Results of the SQL Query
while ( rs.next() ) {
out.println( "<br>" + rs.getString("ename") + "<br>");
conn.close();
catch(SQLException e)
throw new ServletException("Error connecting to Database", e);
out.println("</body></html>");
out.close();
3. Compile the servlet using javac.
D:\j2ee\home>set CLASSPATH=D:\j2ee\home\orion.jar;D:\j2ee\home\jndi.jar;D:\j2ee\home\lib\classes12.jar
D:\j2ee\home>javac GetDSUsingJNDI.java
You have to include D:\j2ee\home\jndi.jar in the libraries for the project
properties for the project in the Jdeveloper to compile this in Jdeveloper.
4. Deploy the servlet on OC4J by copying the GetDSUsingJNDI.class to:
<9iAS ORACLE_HOME>\j2ee\home\default-web-app\WEB-INF\classes
5. Run your GetDSUsingJNDI Servlet and your servlet should be able to
connect to the database successfully.
http://localhost:8888/servlet/GetDSUsingJNDI
regards
Debu Panda
Oracle

Similar Messages

  • 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;
    }

  • Open and close database connection jsp page

    hi there, i wanna know about how to open database connection to Mysql at the beginning of the page and close the connection at the end of the page. The jsp page contain all processing code.
    plz help me...thx thx

    <html>
    <head>
    <basefont face="Arial">
    </head>
    <body>
    <%@ page language="java" import="java.sql.*" %>
    <%!
    // define variables
    String id;
    String firstName;
    String lastName;
    // define database parameters, change this according to your needs
    String host="localhost";
    String user="root";
    String pass="";
    String db="test";
    String conn;
    %>
    <table border="1" cellspacing="1" cellpadding="5">
    <tr>
    <td><b>id</b></td>
    <td><b>first name</b></td>
    <td><b>last name</b></td>
    </tr>
    <%
    Class.forName("org.gjt.mm.mysql.Driver");
    // create connection string
    conn = "jdbc:mysql://" + host + "/" + db + "?user=" + user 
    + "&password=" + pass;
    // pass database parameters to JDBC driver
    Connection Conn = DriverManager.getConnection(conn);
    // query statement
    Statement SQLStatement = Conn.createStatement();
    // generate query
    // change this query according to your needs
    String Query = "SELECT id, firstname, lastname FROM abook";
    // get result
    ResultSet SQLResult = SQLStatement.executeQuery(Query);
    while(SQLResult.next())
       id = SQLResult.getString("id");
       firstName = SQLResult.getString("firstname");
       lastName = SQLResult.getString("lastname");
            out.println("<tr><td>" + id + "</td><td>" + 
         firstName + "</td><td>" + lastName + "</td></tr>");
    // close connection
    SQLResult.close();
    SQLStatement.close();
    Conn.close();
    %>
    </table>
    </body>
    </html>hi :-)
    i've got that on the net as part of the tutorial on jsp (long long time ago)
    you just have to be resourceful in finding solutions :-)
    try google :-) there are lot's of tutorial available in there ;-)
    goodluck ;-)
    regards,

  • How to correct close database connection after report generation

    Hello
    I have problem a with alive database connection after report creation and report  closing. How to properly to close connection to database?
    Best regards
    Edited by: punkers84 on Jun 17, 2011 10:38 AM

    that's what I am doing... after viewing the report, I call the close method on the window closing event of the container window. but the connection is still open. I had a lot of other issues with my jdbc driver but after downgrading to an older version those issues are resolved.Only this one is still there! Is there any other way to close the connection (like using dbcontroller or etc.)?

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

  • Can i use single database connection in a hole java application?

    can i use single database connection in a hole java application?.I have so many forms to use database connection.

    Theoretically you can. Not only theoretically. I've seen lots of application which only uses one database connection (they were using, oracle or mysql)
    The first reply given here assumed that the answer to
    your question depends only on the design of your
    application. That is not true.Yes it's true. Nothing in the original questions says that you aren't allowed to open or close the single connection that you have. It's looks more like the OP is interested in sharing a connection (i.e having a singleton or a connection pool with only one connection)
    It does also depend on the behaviour of the database
    in the background.
    Most databases have a time out for connections that
    are idle Not a problem. Most implementations of connection pools and applications which keeps a connection open have a timer which calls e.g. select * from dual (if you are using oracle) when the connection has been idle for X minutes.
    (some, like db2 on z/OS, even cancel
    connections, that are not idle, if they are open a
    certain amount of time or have reached a given limit
    of cpu seconds.)You would also have that problem if you had a connection pool with several connections.
    In essence: If you have no control over the time
    your application runs (and therefore your connection
    is open) or over type or the configuration of the
    database you are accessing, you can't do it.See above.
    The closest thing to what you want would be using
    PooledConnections, iif those are supported for the
    database you want to access.Not true.
    Kaj

  • Bc4j.xcfg, database connections and deploying ADF apps to oc4j

    I'm trying to understand how to enable custom database connections on a JDeveloper ADF application deployed to a stand-alone instance of OC4J.
    All entity objects were created as ADF Business Components.
    I looks like the db connection information used by the application is stored in a file named "bc4j.xcfg".
    How would I change the database connection information between different environments, changing the server, port and password information from an OC4J instance?
    I'd like to use an OC4J defined data-sources.xml file, but am looking for the simplest approach for now.

    Tomato tomaato, call it what you will, we now have to spend time (money) figuring out how to change from using the recommended use of a "connection" from Oracle tutorials and in Oracle Press books.
    Plus, neither I nor our client can get JDeveloper ADF 10.1.3 to work on OAS 10.1.2.
    Oracle has been of little help, other than stating to follow documentation. We followed the documentation at least a dozen times and on three different install of OAS 10.1.2.
    Why doesn't JDeveloper have a check-box or button that reconfigures the application to run on 10.1.2 (J2EE 1.3), there is a check-box to change JDK versions (1.4)? This is suspect to me.
    We are going to be speaking with the client this week, and have to state the ADF application works, but NOT on OAS 10.1.2.
    Does ADF work on OAS 10.1.3, absolutely, but the client is in 10.1.2 and can not upgrade at this time.
    I've read in blogs where lots of developers have the same issues without resolution and Oracle should just come out and state that 10.1.3 does not work on 10.1.2.
    So my experience has been a mixed bag with ADF, both in terms of the software and customer support from Oracle.

  • How can I get Connection(Database Connection)on my backing bean

    hello guys!
    How can I get the Database Connection on my managed bean?
    I want to use this connection for my reports.
    thanks a lot!
    alvin

    Alvin,
    You can access the data provider through ADF the binding. The data provider represents the business service you use. Once you have a handle to this you can get the connection.
    You don't mention the business service, so I cannot help you more than this. If it is ADF BC, have a look at http://download.oracle.com/docs/html/B25947_01/toc.htm and the stored procedure section. Steve Muench explains a trick to access the "real" JDBC connect used by ADF BC
    Frank

  • Make use of established database connection

    From within an application in the Application Navigation, I have successfully established a connection to a database which is on another host machine. The steps are:
    right-click on the name of the application > select New > Database Tier > Database Connection > Connection Name ....
    After the connection is done, I am able to see the tables, etc. in the Connection Navigation, i.e., the connection was successful.
    Under the same application, I created a web project and in the project I am writing a servlet. I figure I can make use of the established connection as described above, to create sql statement object? But I do not know how. For example, I named that connection SbConnection, and tried the statements:
      Statment stmt = null;
      stmt = SbConnection.createStatement();
    But it does not work out. I am trying this because the classical way of
      Class.forname(....).newInstance();
      Connection conn = DriverManager.getConnection(......);
    does not work no matter how I tried.
    I am just starting in doing web application, servlet and JSP etc. and would appreciate a lot for any help.

    Fantastic, dvohra! It works out! Thanks a lot for the know-how!
    Next I am going to dig out something to read about JNDI and DataSource type of connection. But the part of editing the web.xml is magic and myth to me. Any suggested books or web sites for reading? (After know-how is know-why and know what I am doing.) Many thanks!

  • Problem With Midlet Database Connectivity

    Hi, I am into an application which reures database connectivity.I want to connect to Ms Access as backend with JDBC support.Ive searched a lot but found RMS as the only answer.I will be very thankful if some one can send me a code snippet or some link to an article which shows the trail to my problem.

    You can't have an MS Access database on the phone itself. And even if you can (on an MS SmartPhone maybe?), MIDP has no way to connect to it.
    But if you need to connect to a database that's hosted on a server, then what you have to do is set up a regular web server (using ASP, Servlets, PHP, whatever you fancy), and communicate with this server using the General Connection Framework (that's the javax.microedition.io.* classes). The web server, instead of outputting data in HTML format, can output the data in a format you design and know how to read and parse on your MIDlet (for example, for a simple application a comma separated string will do, for something more complicated maybe you want to use XML, or even develop your own binary format).
    If you want the data to be stored on the client then I'm afraid you're stuck with the RMS.
    shmoove

  • Jdev 10g Preview Database Connection Error

    HI,
    I'm trying to create a database connection in Jdev 10.1.3.0.2 .
    When i press "Test Connection" i receive the following error.
    ORA-00604: error occurred at recursive SQL level 1
    ORA-12705: invalid or unknown NLS parameter value specified
    I used previous versions or JDev and never had this problem.
    Thank You. JP.

    I'm using the Jdev 10.1.3 default installation.
    I didn't change anything.
    Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production (AIX)
    With the Partitioning option
    JServer Release 9.2.0.5.0 - Production
    This is the jdev.conf file. I don't know what is wrong.
    I tried deleting the lines where is "AddVMOption -Doracle.translated.locales=ja ", but i receive the same error.
    Thank you. JP.
    # Oracle JDeveloper 10g Launcher Configuration File
    # Copyright 2000-2004 Oracle Corporation.
    # All Rights Reserved.
    # The format of this file is:
    # "Directive Value" (with one or more spaces and/or tab characters
    # between the directive and the value) This file can be in either UNIX
    # or DOS format for end of line terminators. Any path seperators must be
    # UNIX style forward slashes '/', even on Windows.
    AddJavaLibPath ../lib/patches
    AddJavaLibFile ../../../classes
    AddJavaLibFile ../../ide/lib/javax-ide.jar
    AddJavaLibFile ../../ide/lib/javatools.jar
    AddJavaLibFile ../../ide/lib/ide.jar
    AddJavaLibFile ../lib/looks-1.2.1.jar
    AddJavaLibFile ../../jlib/jewt4.jar
    AddJavaLibFile ../../jlib/share.jar
    AddJavaLibFile ../../jlib/help4.jar
    AddJavaLibFile ../../jlib/inspect4.jar
    AddJavaLibFile ../../lib/xmlparserv2.jar
    AddJavaLibFile ../lib/jdev-ep.jar
    SetUpdateMainClass oracle.ideimpl.webupdate.DeferredUpdater
    SetUpdateClassPath ../../../classes:../lib/jdev.jar:../../ide/lib/ide.jar:../../ide/lib/javatools.jar:../../lib/xmlparserv2.jar:../../jlib/jewt4.jar:../../jlib/share.jar
    # Extensions in jdev/lib/ext may require native libraries
    AddNativeCodePath ../lib/ext
    # Oracle9i Lite Settings
    # Enable these lines (and modify the directories)
    # to suit your Oracle Lite installation
    # AddNativeCodePath C:/Oracle/lite5/mobile/sdk/bin
    # AddJavaLibFile C:/Oracle/Lite5/mobile/classes/olite40.jar
    # Directive SetJavaHome is not required by default, except for the base
    # install, since the launcher will determine the JAVA_HOME. On Windows
    # it looks in ..\..\jdk, on UNIX it looks in the PATH by default.
    # SetJavaHome c:\jdk1.4.2_03
    # The Windows launcher will attempt to use client (hotspot) by default,
    # unless a VM is specified below with the following directive. On UNIX
    # we use whatever is listed first in the $(JAVA_HOME)/jre/lib/jvm.cfg file.
    SetJavaVM hotspot
    # JDK 1.4.2 specific setting, to properly run JDeveloper under JDK 1.4.2,
    # the following property needs to be enabled and set to false. The bug
    # (Sun bug #4895132) has been fixed in JDK 1.5.
    # AddVMOption -Dsun.io.useCanonCaches=false
    # This will enable a "virtual" file system feature within JDeveloper.
    # This can help performance for projects with a lot of files,
    # particularly under source control. For non-Windows platforms however,
    # any file changes made outside of JDeveloper, or by deployment for
    # example, may not be picked by the "virtual" file system feature. Do
    # not enable this for example, on a Linux OS if you use an external editor.
    # AddVMOption -DVFS_ENABLE=true
    # Turn off verifications since the included classes are already verified by the
    # compiler. This will reduce startup time significantly. On some Linux
    # Systems, using -Xverify:none will cause a SIGABRT, if you get this, try
    # removing this option.
    AddVMOption -Xverify:none
    # Set the maximum heap to 512M
    AddVMOption -Xmx512M
    # MaxPermSize is required to run JDeveloper with Sun Microsystems virtual
    # machine (-client and -server). The default value is 64M, which isn't enough
    # to run JDeveloper successfully. With the default value, JDeveloper will
    # end up running out of memory at some point in time. This option is ignored
    # by OJVM (-ojvm).
    # This option is documented at:
    # http://java.sun.com/docs/hotspot/gc1.4.2/faq.html
    AddVMOption -XX:MaxPermSize=128M
    # Option used by OJVM client on Windows, This option will turn on line numbers
    # in the stack traces by disabling the optimizing compiler.
    # AddVMOption -XOd
    # Enabling this option will cause OJVM client on Windows to only use 1 CPU on
    # a multi-processor system, on single-cpu systems, this option has no effect.
    # AddVMOption -Xsinglecpu
    # Disable Direct Draw, on some Windows 2000/XP base computers,
    # Direct Draw is cause excessive screen refreshes and slows down drawing.
    # Disabled by default for all Windows platform.
    AddVMOption -Dsun.java2d.noddraw=true
    # If true, prevent laucher from handle -help command line argument and
    # passes -help to the java application.
    # Disabled by default
    # AddVMOption -Dapplication.handle.help=true
    # If set to true, prevent laucher from checking/setting the shell
    # integration mechanism.
    # The shell integration feature is enabled by default
    # AddVMOption -Dno.shell.integration=true
    # Disable the forced GC for the ICE browser.
    AddVMOption -Dice.browser.forcegc=false
    # Reduce the tile threshold for the ICE browser.
    AddVMOption -Dice.pilots.html4.tileOptThreshold=0
    # Prepend patches to the bootclasspath. Currently, rtpatch.jar contains a
    # patch that fixes the javax.swing.JTree accessibility problems.
    # Uncomment the line below if you need to run JDeveloper under JAWS.
    # AddVMOption -Xbootclasspath/p:../../jdk/jre/lib/patches/rtpatch.jar
    # Replace heavyweight AWT controls with lightweight implementations.
    AddVMOption -Xbootclasspath/p:../lib/lwawt.jar
    # This setting must not be changed.
    SetMainClass oracle.jdeveloper.JDeveloper
    # SetUserHomeVariable is used to define an environment variable
    # that overrides the default user home location. The directory
    # pointed to by the environment variable defined here will be
    # used to store user settings and the "mywork" directory.
    # On UNIX platforms the default setting is $HOME/jdevhome
    SetUserHomeVariable JDEV_USER_DIR
    # If you run into problems related to relocation errors of system dll's, use
    # this option to resolve them. This option only works under ojvm.
    # AddVMOption -Xheapbase10000000
    # A list of filenames that are reserved
    AddVMOption -Dreserved_filenames=con,aux,prn,lpt1,lpt2,lpt3,lpt4,lpt5,lpt6,lpt7,lpt8,lpt9,com1,com2,com3,com4,com5,com6,com7,com8,com9,conin$,conout$
    # Indicates which version of the jdk to use for editor syntax
    # highlighting and code explorer. Valid values are: "1.3", "1.4", "1.5".
    AddVMOption -DEDITOR_J2SE_VERSION=1.5
    # Whether Code Insight will omit types and members that have been
    # denoted with the @hidden tag.
    AddVMOption -DINSIGHT_OMIT_HIDDEN=true
    # Text buffer deadlock detection setting (OFF by default.) Uncomment
    # out the following option if encountering deadlocks that you suspect
    # buffer deadlocks that may be due to locks not being released properly.
    # AddVMOption -Dbuffer.deadlock.detection=true
    # If you use JDeveloper in a multibyte environment the embedded browser
    # may display all multibyte characters as squares. If this happens you
    # can use the following option to avoid the problem.
    # AddVMOption -Dice.pilots.html4.ignoreNonGenericFonts=true
    # Put the xml parser into 9.0.4 compatability mode (3116160)
    AddVMOption -Doracle.xdkjava.compatibility.version=9.0.4
    # Specify the set of extant translations for resources loaded via
    # BundleLoader. The format is a comma separated list of locales, for
    # example ja,fr_CA. A translation will only be found if included in
    # the list.
    # Comment out the option to force BundleLoader to use the default
    # locale. This is different to giving the property no value,
    # meaning there are no translations.
    # Note that this has no impact on ResourceBundle, which will continue
    # to try to load locale specific resources even if they are certain not
    # to exist.
    AddVMOption -Doracle.translated.locales=ja
    # Temporary internal flag to enable trace messages for the IDE
    # controller stack.
    AddVMOption -Dide.debug.controller.stack=false
    # If you need to connect to OC4J 10.1.2 from JDeveloper, uncomment the
    # following option. Note, however, that enabling this option will prevent
    # JDeveloper from connecting to OC4J 10.1.3.
    # AddVMOption -Drmi.disablePropagation=true
    AddVMOption -Doracle.translated.locales=ja

  • Help! My database connection from BMP Entity bean dies after a while!!!

    Hi all!
    I posted a related post about this lately How do I use connection pooling from BMP Entity Beans in OC4J 10.1.2? but it didn't solve my problems.
    I have some entity beans coded with BMP, so I handle all database stuff myself. I have set up datasources.xml like this:
        <data-source
            class="com.evermind.sql.DriverManagerDataSource"
            name="OracleDS"
            location="jdbc/OracleCoreDS"
            xa-location="jdbc/xa/OracleXADS"
            ejb-location="jdbc/OracleDS"
            connection-driver="oracle.jdbc.driver.OracleDriver"
            username="scott"
            password="tiger"
            url="jdbc:oracle:thin:@//URL TO DB:SID"
            inactivity-timeout="30"
            min-connections="10"
            max-connections="50"
        />All JNDI connection lookup is done through the ejb-location as I should. I have been through all my try {} catch {} finally {} blocks, so ensure that I close all objects after use.
    After a few hours of inactivity, my program dies. I have inserted a lot of debug statements (System.out.println()), and it seems like the program hangs when it's trying to execute a PreparedStatement.
    I.e. it dies when I do ps.ExecuteQuery in the code below (NOTE: to make things easier to read, I have stripped out all error handling here):
        Context ic = new InitialContext();
        DataSource ds = (DataSource)ic.lookup("jdbc/OracleDS");
        c = ds.getConnection();
        System.out.println("DEBUG: Got database connection.");
        PreparedStatement ps = c.prepareStatement("SELECT foobar FROM footable WHERE foo=?");
        System.out.println("DEBUG: Prepared SQL statement.");
        ps.setString(1,"foo");
        ResultSet rs = ps.executeQuery();
        // Close all objects (rs, ps, c) here.My database is on another physical server, so I wonder if this is caused by an unstable network, or?
    Please help!
    ~Morten

    Hi again!
    Sorry for the delay, but I have been busy lately.
    Anyway: Our application server is 10.1.2, so I don't think patch 4307303 is relevant here. Database server is Oracle 9.2.0.6. Everything runs on Linux (of course) ;-).
    Here's a thread dump:
    Full thread dump Java HotSpot(TM) Server VM (1.4.2_04-b05 mixed mode):
    "ApplicationServerThread-8" prio=1 tid=0x089a9448 nid=0x5902 in Object.wait() [885e6000..885e687c]
         at java.lang.Object.wait(Native Method)
         at EDU.oswego.cs.dl.util.concurrent.SynchronousChannel.poll(SynchronousChannel.java:353)
         - locked <0x91a31e60> (a EDU.oswego.cs.dl.util.concurrent.LinkedNode)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor.getTask(PooledExecutor.java:767)
         at com.evermind.util.ReleasableResourcePooledExecutor.myGetTask(ReleasableResourcePooledExecutor.java:151)
         at com.evermind.util.ReleasableResourcePooledExecutor.access$000(ReleasableResourcePooledExecutor.java:33)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:190)
         at java.lang.Thread.run(Thread.java:534)
    "AJPRequestHandler-ApplicationServerThread-7" prio=1 tid=0x08d78a58 nid=0x5902 runnable [8b2f4000..8b2f587c]
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:129)
         at oracle.net.ns.Packet.receive(Unknown Source)
         at oracle.net.ns.DataPacket.receive(Unknown Source)
         at oracle.net.ns.NetInputStream.getNextPacket(Unknown Source)
         at oracle.net.ns.NetInputStream.read(Unknown Source)
         at oracle.net.ns.NetInputStream.read(Unknown Source)
         at oracle.net.ns.NetInputStream.read(Unknown Source)
         at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:978)
         at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:950)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:434)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:661)
         at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:959)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:693)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1065)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2901)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:2942)
         - locked <0x914cad08> (a oracle.jdbc.driver.T4CPreparedStatement)
         - locked <0x920256c0> (a oracle.jdbc.driver.T4CConnection)
         at com.evermind.sql.FilterPreparedStatement.executeQuery(FilterPreparedStatement.java:270)
         at com.evermind.sql.FilterPreparedStatement.executeQuery(FilterPreparedStatement.java:270)
         at com.evermind.sql.PreparedStatementBCELProxy.executeQuery(PreparedStatementBCELProxy.java:31)
         at com.brunata.servicerapport.ejb.CustomerBean.ejbCreate(Unknown Source)
         at CustomerLocalHome_EntityHomeWrapper2.create(CustomerLocalHome_EntityHomeWrapper2.java:420)
         at com.brunata.servicerapport.BeanFactory.getCustomerBean(Unknown Source)
         at com.brunata.servicerapport.CustomerOpenAction.execute(Unknown Source)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at com.brunata.servicerapport.CustomerAuthorizationFilter.doFilter(Unknown Source)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-23" daemon prio=1 tid=0x092ebb18 nid=0x5902 in Object.wait() [88565000..8856587c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x920000f0> (a java.util.TaskQueue)
         at java.util.TimerThread.mainLoop(Timer.java:429)
         - locked <0x920000f0> (a java.util.TaskQueue)
         at java.util.TimerThread.run(Timer.java:382)
    "Thread-22" daemon prio=1 tid=0x092eb988 nid=0x5902 in Object.wait() [8dfa0000..8dfa087c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x92000188> (a java.util.TaskQueue)
         at java.util.TimerThread.mainLoop(Timer.java:429)
         - locked <0x92000188> (a java.util.TaskQueue)
         at java.util.TimerThread.run(Timer.java:382)
    "AJPRequestHandler-ApplicationServerThread-6" prio=1 tid=0x08c03240 nid=0x5902 runnable [8b0f1000..8b0f187c]
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:129)
         at com.evermind.io.SingleReadBufferInputStream.readChunk(SingleReadBufferInputStream.java:116)
         at com.evermind.io.SingleReadBufferInputStream.read(SingleReadBufferInputStream.java:35)
         at com.evermind.server.http.AJPRequestHandler.readAJPPackets(AJPRequestHandler.java:462)
         at com.evermind.server.http.AJPRequestHandler.initRequest(AJPRequestHandler.java:396)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:185)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    "DestroyJavaVM" prio=1 tid=0x08053278 nid=0x5902 waiting on condition [0..bfffcac4]
    "OC4JMonitorThread" daemon prio=1 tid=0x08d7a5a0 nid=0x5902 in Object.wait() [88667000..8866787c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x92aed1f8> (a java.lang.Object)
         at oracle.ons.NotificationQueue.internalDequeue(NotificationQueue.java:253)
         - locked <0x92aed1f8> (a java.lang.Object)
         at oracle.ons.NotificationQueue.dequeue(NotificationQueue.java:226)
         at oracle.ons.Subscriber.receive(Subscriber.java:136)
         at com.evermind.server.OC4JMonitorThread.run(OC4JMonitorThread.java:315)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-6" daemon prio=1 tid=0x087f9f98 nid=0x5902 in Object.wait() [886e8000..886e887c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x92aed368> (a java.lang.Object)
         at java.lang.Object.wait(Object.java:429)
         at oracle.ons.NotificationQueue.internalDequeue(NotificationQueue.java:255)
         - locked <0x92aed368> (a java.lang.Object)
         at oracle.ons.NotificationQueue.dequeue(NotificationQueue.java:215)
         at oracle.ons.SenderThread.run(SenderThread.java:81)
    "Thread-5" daemon prio=1 tid=0x087f9d10 nid=0x5902 runnable [88769000..8876987c]
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:129)
         at oracle.ons.InputBuffer.readMoreData(InputBuffer.java:267)
         at oracle.ons.InputBuffer.getNextString(InputBuffer.java:222)
         at oracle.ons.ReceiverThread.run(ReceiverThread.java:228)
    "TaskManager" prio=1 tid=0x087f9b30 nid=0x5902 waiting on condition [887ea000..887ea87c]
         at java.lang.Thread.sleep(Native Method)
         at com.evermind.util.TaskManager.run(TaskManager.java:247)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-4" prio=1 tid=0x08ca2fb8 nid=0x5902 in Object.wait() [891e2000..891e287c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x92aee258> (a java.util.TaskQueue)
         at java.util.TimerThread.mainLoop(Timer.java:429)
         - locked <0x92aee258> (a java.util.TaskQueue)
         at java.util.TimerThread.run(Timer.java:382)
    "AJPConnectionListener [0.0.0.0/0.0.0.0:3302]" prio=1 tid=0x086f1668 nid=0x5902 runnable [8a7ca000..8a7ca87c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x927a0390> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at com.evermind.server.http.AJPConnectionListener.run(AJPConnectionListener.java:60)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    "RMIServer [0.0.0.0:3202] count:2" prio=1 tid=0x086cbff0 nid=0x5902 runnable [8b172000..8b17287c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x927a0850> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at com.evermind.server.rmi.RMIServer.run(RMIServer.java:464)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    "JMSServer[webprod:3702]" prio=1 tid=0x0879aff0 nid=0x5902 runnable [8b1f3000..8b1f387c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x92746aa0> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at com.evermind.server.jms.JMSServer.run(JMSServer.java:516)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    "LogFlusher" daemon prio=1 tid=0x081b91a0 nid=0x5902 waiting on condition [8b274000..8b27487c]
         at java.lang.Thread.sleep(Native Method)
         at oracle.core.ojdl.BufferedLogWriter$Flusher.run(BufferedLogWriter.java:354)
    "Signal Dispatcher" daemon prio=1 tid=0x080ba9e0 nid=0x5902 waiting on condition [0..0]
    "Finalizer" daemon prio=1 tid=0x080b61a8 nid=0x5902 in Object.wait() [8e9a7000..8e9a787c]
         at java.lang.Object.wait(Native Method)
         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
         - locked <0x925b0378> (a java.lang.ref.ReferenceQueue$Lock)
         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
         at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
    "Reference Handler" daemon prio=1 tid=0x080b5dc8 nid=0x5902 in Object.wait() [8ea28000..8ea2887c]
         at java.lang.Object.wait(Native Method)
         at java.lang.Object.wait(Object.java:429)
         at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:115)
         - locked <0x925b02a0> (a java.lang.ref.Reference$Lock)
    "VM Thread" prio=1 tid=0x080b52e0 nid=0x5902 runnable
    "VM Periodic Task Thread" prio=1 tid=0x080bee08 nid=0x5902 waiting on condition
    "Suspend Checker Thread" prio=1 tid=0x080b9fc8 nid=0x5902 runnable As far as I can see, my PreparedStatement (or connection) is locked.... Any ideas?
    ~Morten ;-)

  • Jdeveloper Crashing When Opening MDB Database Connection

    Hello,
    I created a database connection to one of the local access mdb file using jdbc-odbc connection type.
    When I tried to view the tables or when I try to create a toplink connection using the same connection I created to access mdb file, my Jdeveloper is crashing.
    Any what could be the reason.
    My Jdeveloper version:
    10.1.3.4.0
    Regards
    Edited by: user20090209 on Oct 13, 2009 7:43 AM

    Time marches forward and I have no disagreement with any of the Weblogic decisions. The reality is though that we still do not have a clear answer from Oracle (although our clients sales folks are working on it) as to whether the client will have to pay to "upgrade" their Oracle Application Server (Enterprise) licenses to get the WebLogic server necessary to run the applications created by the final Production JDeveloper11g. If it costs money then it requires budgeting and that all takes a lot of time.
    We have a fairly rich application already developed and we cannot port it to Weblogic until the licensing issues are resolved. Until that happens it will have to continue to run on the OC4J container.
    BUT ... I consider this "not a problem" with respect to TP4 not running on Vista 64-bit as long as the final release JDeveloper 11g does. I'll just have to work in my VPC hosted XP Client until our clients get their licensing issues sorted out with Oracle.
    Mark

  • Timeout: Tuxedo kills the service but not the database connection

    Hi all,
    I am experiencing some performance problems on my system due an efficient SQL and a Tuxedo improper timeout handling.
    A service is using a "problematic" SQL (we will tune it but it's not the main problem). After 60 seconds from the execution, Tuxido kills the services for a timeout.
    At this point I would like Tuxedo to notify DB2 database as well in order to stop processing the SQL. Instead the SQL continues running on the database (also if the service is killed) and this produce a gradual slow down of the performances.
    In the UBBCONFIG, we are using a service configuration like the following timeout configuration:
    .RESOURCES
    SCANUINIT 5
    SANITYSCAN 6
    BLOCKTIME 12
    .SERVICES
    DEFAULT: SVCTIMEOUT=45
    service1 SVCTIMEOUT=60 TRANTIME=60
    service2 SVCTIMEOUT=60 TRANTIME=60
    Note: not all the services are listed in the .SERVICES section and we are using the default NOTIFY as well as an OPENINFO.
    Can you please help me in finding a configuration to kill both the services and the database?
    Thanks in advance,
    Benedetto

    Hi Benedetto.
    First of all, Tuxedo doesn't kill services, it kills servers. Your UBBCONFIG file specifies three timeouts, BLOCKTIME, SVCTIMEOUT, and TRANTIME.
    BLOCKTIME specifies how long a Tuxedo API that needs a response will wait for that response. If the response isn't received in that period of time, Tuxedo will return TPETIME to the caller. As with any failure, if the request was part of a transaction, the transaction is marked rollback only. Note, this timeout does not affect the request, whether sitting in a server's IPC queue or currently executing in a server.
    SVCTIMEOUT is a much more severe timeout and determines how long Tuxedo will allow a service implementation to execute. If a service implementation doesn't reply within the SVCTIMEOUT period, Tuxedo will issue an OS level KILL request to kill the process. If the server is marked restartable, Tuxedo will then try to restart the server assuming none of the restart limits have been reached. Killing the server causes the request to be lost within the server so the caller will stay blocked until BLOCKTIME is reached at which point the above actions will take place.
    TRANTIME is the amount of time Tuxedo allows a transaction to remain active and viable. When this period expires, Tuxedo will mark the transaction as timed out with the only option being rollback. As well, Tuxedo aborts any API requests that would normally cause messaging to occur, i.e., making a tpcall() within a timed out transaction will fail without any attempt to call the service.
    So in your case, the issue is partially that you have the values of your timeouts in somewhat reverse order. Typically we see BLOCKTIME being the smallest value, with TRANTIME typically larger than BLOCKTIME, and SVCTIMEOUT larger even still, although there are good reasons for exceptions to this guideline. Part of the reasoning behind this is that killing a server is a significant thing and its usually best to try and let the server complete whatever its doing, if if the work has been timed out either due to BLOCKTIME or TRANTIME, since the cost of killing and restarting a server is significant.
    Tuxedo will notify the database of the transaction status when the application finally issues a tpcommit() or a tpabort() request, but not until then. Although, if SVCTIMEOUT is hit, then killing the server should cause the database connection to be lot.
    If you could describe the behavior you are seeing and the relevant portions of your ULOG we can try to make some sense of what is happening.
    Regards,
    Todd Little
    Oracle Tuxedo Chief Architect

  • Database connectivity to business objects

    Post Author: kshatri
    CA Forum: Administration
    Hi All,
    I am new to for my first project, having good knowledge about BO but my only concern is with the first day target.
    As a new team mate memeber what are my roles and responsibilites to be done.
    How to interact with the Administrator to get my database connectivity and then how to implement the path provided by the admin people to get my database activate and then to connect it to the business objects.
    So again i am requesting you all if you any one among you, who has already gone through this situation  could help and make to understand how to connect the database to business objects.
    And how to present ourslef in a new environment.
    Thanks,
    Anu.

    Post Author: jsanzone
    CA Forum: Administration
    Anu,
    This is one of those forum threads that could last all year with comments, tips, and criticisms.  If you have a lot of knowledge about BusObjects, then you are nearly half way there.  In my experience, the biggest road block to success is communication and team cohesiveness.  If everyone on the project are not communicating with each other then everything is going to fail.  What do I mean about communication?  It's hard to pin down, but when I see it I'll know it's there (smile).  For starters it's having a good plan that everyone can work from.  An underlying theme in communications is also trust.  The folks who hand out the userids and passwords must be able to trust the folks who are receiving the privileges.  If the administrator must give you read/write access to his or her database and they don't "know" you, then this is an uphill battle.  Many administrators do not understand middleware such as BusObjects, they are more familiar with things like Access, and such -- the more simpler applications.  When you try throwing terms around like business intelligence, single-sign on, multiple queries, data providers, meta data, report viewer, etc, etc their heads start to spin and they want you OUT of their sight.  All of these concepts must be introduced gently and in an appropriate setting.  The admins must get familiar and comfortable with your tools before you can make headway.  So that is what I mean by communication, in this case laterally.  You must also communicate upwards (the C-level folks), and downward, the users.  Like I said, folks could add to this thread infinitum, and I would invite other as such, but here are some things to think about as you move forward.  The best teacher is experience, but who has time for that?

Maybe you are looking for

  • How to restore a SP 2010 Foundation site collection in a SP 2010 Enterprise Server?

    Is it possible to backup a Foundation site collection and restore it in an Enterprise Server? Or should we use export/import? Which is the best way to perform this? Thank you J.Clua

  • Subquery in materialized view

    I have this subquery in a materialized view. (SELECT COUNT(*)     FROM product_statistics_units psu     INNER JOIN scenes_identity_fact sif     ON (trunc(sif.date_acquired) = trunc(psu.scene_date))     AND ((SELECT satellite_sensor_key         FROM l

  • JSP / HTML page does not load correctly in IE

    I have a particular jsp page, which has heavy volume of data and it does not load completely in IE, but loads perfectly in Firefox and Safari. It is a really perpleximg problem that occurs only when the volume of data is large. None of the people in

  • Patch 2744619 causes portlet could not be contacted

    Hello, Any anyone installed the Portlet patch 2744619 in an HTTPS configuration? The patch successfully installs, no errors in the install log or portal.log. But when I log into Portal, ALL Portlets have this error message: The Portlet Could Not Be C

  • Problems streaming photos

    I cannot transfer my photos from the iphone to may mac using streaming, only by cable. I made all the installs in my mac and my iphone and it doesn't work.