Do I close my connection yet? How to improve it

Hi all,
my connection pool is not working well, the connection is not release back to pool. why??
package formate;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import javax.sql.*;
import pool.ConnectionPool;
* TryJdbc.java
* This servlet demonstrates using JDBC
public class Formate extends HttpServlet {
   Statement stmt =null;
    ResultSet rs = null;
    Connection conn = null;
  ConnectionPool connectionPool = null;
* Creates a connection pool.
public void init() throws ServletException
String jdbcDriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String dbURL ="jdbc:microsoft:sqlserver://localhost:1433; DatabaseName=sequences";
try
//instantiate the connection pool object by passing the
//jdbc driver, database URL, username, and password
connectionPool = new ConnectionPool(jdbcDriver, dbURL,
"A#$","RE@89");
//specify the initial number of connections to establish
connectionPool.setInitialConnections(5);
//specify number of incremental connections to create if
//pool is exhausted of available connections
connectionPool.setIncrementalConnections(5);
//specify absolute maximum number of connections to create
connectionPool.setMaxConnections(20);
connectionPool.createPool(); //create the connection pool
catch(Exception e)
System.out.println("Error: " + e);
}in my doget I have
conn = connectionPool.getConnection();
     stmt = conn.createStatement();
...query
finally {
try {
if(rs != null)
rs.close();
rs = null;
if(stmt != null)
stmt .close();
stmt = null;
if(conn != null)
conn.close();
conn = null;
connection.returnConnection(conn); }
package pool;
import java.sql.*;
import java.util.*;
public class ConnectionPool
private String jdbcDriver = "";
private String dbUrl = "";
private String dbUsername = "";
private String dbPassword = "";
private int initialConnections = 10;
private int incrementalConnections =5;
private int maxConnections = 50;
private Vector connections = null;
* Constructor stores the parameters passed by the calling
* object.
* @param jdbcDriver String containing the fully qualified name
* of the jdbc driver (class name and full package info)
* @param dbUrl String containing the database URL
* @param dbUsername String containing the username to use when
* logging into the database
* @param dbPassword String containing the password to use when
* logging into the database
public ConnectionPool(String jdbcDriver, String dbUrl,
String dbUsername, String dbPassword)
this.jdbcDriver = jdbcDriver;
this.dbUrl = dbUrl;
this.dbUsername = dbUsername;
this.dbPassword = dbPassword;
* Returns the initial number of connections to create.
      * @return Initial number of connections to create.
public int getInitialConnections()
return initialConnections;
      * Sets the initial number of connections to create.
* @param initialConnections Initial number of connections to
* create
public void setInitialConnections(int initialConnections)
this.initialConnections = initialConnections;
* Returns the number of incremental connections to create if
* the initial connections are all in use.
* @return Number of incremental connections to create.
public int getIncrementalConnections()
return incrementalConnections;
* Sets the number of incremental connections to create if
* the initial connections are all in use.
*@param incrementalConnections Number of incremental
* connections to create.
public void setIncrementalConnections(
int incrementalConnections)
this.incrementalConnections = incrementalConnections;
* Returns the absolute maximum number of connections to
      * create. If all connections are in use, the getConnection()
* method will block until one becomes free.
* @return Maximum number of connections to create.
public int getMaxConnections()
return maxConnections;
* Sets the absolute maximum number of connections to create.
* If all connections are in use, the getConnection() method
* will block until one becomes free.
* @param maxConnections Maximum number of connections to
* create.
public void setMaxConnections(int maxConnections)
this.maxConnections = maxConnections;
* Creates a pool of connections. Number of connections is
* determined by the value of the initialConnections property.
public synchronized void createPool() throws Exception
//make sure that createPool hasn't already been called
if (connections!=null)
return; //the pool has already been created, return
//instantiate JDBC driver object from init param jdbcDriver
Driver driver = (Driver)
(Class.forName(jdbcDriver).newInstance());
DriverManager.registerDriver(driver); //register JDBC driver
connections = new Vector();
//creates the proper number of initial connections
createConnections(initialConnections);
* Creates the specified number of connections, places them in
* a PooledConnection object, and adds the PooledConnection to
* the connections vector.
* @param numConnections Number of connections to create.
private void createConnections(int numConnections) throws
SQLException
//create the specified number of connections
for (int x=0; x < numConnections; x++)
//have the maximum number of connections been created?
//a maxConnections value of zero indicates no limit
if (maxConnections > 0 &&
connections.size() >= maxConnections)
break; //break out of loop because we're at the maximum
//add a new PooledConnection object to connections vector
connections.addElement(new PooledConnection(
newConnection()));
System.out.println("Database connection created...");
* Creates a new database connection and returns it.
* @return New database connection.
private Connection newConnection() throws SQLException
//create a new database connection
Connection conn = DriverManager.getConnection (dbUrl,
dbUsername, dbPassword);
//if this is the first connection, check the maximum number
//of connections supported by this database/driver
if (connections.size()== 0)
DatabaseMetaData metaData = conn.getMetaData();
int driverMaxConnections = metaData.getMaxConnections();
//driverMaxConnections value of zero indicates no maximum
//or unknown maximum
if (driverMaxConnections > 0 &&
maxConnections > driverMaxConnections)
maxConnections = driverMaxConnections;
return conn; //return the new connection
* Attempts to retrieve a connection from the connections
* vector by calling getFreeConnection(). If no connection is
* currently free, and more can not be created, getConnection()
* waits for a short amount of time and tries again.
* @return Connection object
public synchronized Connection getConnection()throws
SQLException
//make sure that createPool has been called
if (connections == null)
return null; //the pool has not been created
Connection conn = getFreeConnection();//get free connection
while (conn == null) //no connection was currently free
//sleep for a quarter of a second and then check to see if
//a connection is free
wait(250);
conn = getFreeConnection(); //try again to get connection
return conn;
* Returns a free connection from the connections vector. If no
* connection is available, a new batch of connections is
* created according to the value of the incrementalConnections
* variable. If all connections are still busy after creating
* incremental connections, the method will return null.
* @return Database connection object
private Connection getFreeConnection() throws SQLException
//look for a free connection in the pool
Connection conn = findFreeConnection();
if (conn == null)
//no connection is free, create additional connections
createConnections(incrementalConnections);
//try again to find a free connection
conn = findFreeConnection();
if (conn == null)
//there are still no free connections, return null
return null;
return conn;
* Searches through all of the pooled connections looking for
* a free connection. If a free connection is found, its
* integrity is verified and it is returned. If no free
* connection is found, null is returned.
* @return Database connection object.
private Connection findFreeConnection()throws SQLException
Connection conn = null;
PooledConnection pConn = null;
Enumeration enum = connections.elements();
//iterate through the pooled connections looking for free one
while (enum.hasMoreElements())
pConn =(PooledConnection)enum.nextElement();
if (!pConn.isBusy())
//this connection is not busy, get a handle to it
conn = pConn.getConnection();
pConn.setBusy(true); //set connection to busy
//connection is no longer valid, create a new one
conn = newConnection();
//replace invalid connection with new connection
pConn.setConnection(conn);
break; //we found a free connection, stop looping
return conn;
* Test the connection to make sure it is still valid. If not,
* close it and return FALSE.
* @param conn Database connection object to test.
* @return True indicates connection object is valid.
* Turns off the busy flag for the current pooled connection.
* All ConnectionPool clients should call returnConnection() as
* soon as possible following any database activity (within a
* finally block).
* @param conn Connection object
public void returnConnection(Connection conn)
//make sure that createPool has been called
if (connections== null)
return; //the pool has not been created
PooledConnection pConn = null;
Enumeration enum = connections.elements();
//iterate through the pooled connections looking for the
//returned connection
while (enum.hasMoreElements())
pConn =(PooledConnection)enum.nextElement();
//determine if this pooled connection contains the returned
//connection
if (conn == pConn.getConnection())
//the connection has been returned, turn off busy flag
pConn.setBusy(false);
break;
* Refreshes all of the connections in the connection pool.
public synchronized void refreshConnections()throws
SQLException
//make sure that createPool has been called
if (connections == null)
return; //the pool has not been created
PooledConnection pConn = null;
Enumeration enum = connections.elements();
while (enum.hasMoreElements())
pConn =(PooledConnection)enum.nextElement();
if (!pConn.isBusy())
wait(10000); //wait 5 seconds
closeConnection(pConn.getConnection());
          pConn.setConnection(newConnection());
          pConn.setBusy(false);
* Closes all of the connections and empties the connection
* pool. Once this method has been called, the createPool()
* method can again be called.
public synchronized void closeConnections() throws SQLException
//make sure that createPool has been called
if (connections == null)
return; //the pool has not been created
PooledConnection pConn = null;
Enumeration enum = connections.elements();
while (enum.hasMoreElements())
pConn = (PooledConnection)enum.nextElement();
if (!pConn.isBusy())
wait(5000); //wait 5 seconds
closeConnection(pConn.getConnection());
connections.removeElement(pConn);
connections = null;
* Closes a database connection.
* @param conn Database connection to close.
private void closeConnection(Connection conn)
try
conn.close();
catch (SQLException e)
* Sleeps for a specified number of milliseconds.
*@param mSeconds Number of seconds to sleep.
private void wait(int mSeconds)
try
Thread.sleep(mSeconds);
catch (InterruptedException e)
* Inner class encapsulating the properties of a pooled
* connection object. These properties include a JDBC database
* connection object and a flag indicating whether or not the
* database object is currently in use (busy).
class PooledConnection
Connection connection = null;
boolean busy = false;
public PooledConnection(Connection connection)
this.connection = connection;
public Connection getConnection()
return connection;
public void setConnection(Connection connection)
this.connection = connection;
public boolean isBusy()
return busy;
public void setBusy(boolean busy)
this.busy = busy;
}thank you

If you are using connection pooling then those places in your code where you used to close a connection need to be replaced by code that returns the connection to the pool.
It's the job of the pool implementation to decide whether or not connections need closing (or opening), depending on the rules you set up for the pooler.

Similar Messages

  • I am connected to my usual wifi and when I try to go onto any apps which require internet connection, it says I have no internet connection yet I am connected to wifi, how do I resolve this?

    I am connected to my usual wifi and when I try to go onto any app's which require Internet connection, it says I have no Internet connection yet I am connected to wifi, how do I resolve this?I have had this problem for about a week.
    Any responses are appriciated

    You posted in the iPad forum, but you profile lists an iPhone 4S. Does your iPhone or iPad have this problem.
    Here's some iPad suggestions. Most also apply to the iPhone. Your iPhone or iPad may show the wifi symbol but that only shows the presence of a wifi signal. Not that you are connected.
    Some things to try first:
    1. Turn Off your iPad. Then turn Off (disconnect power cord for 30 seconds or longer) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    2. Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
    3. Change the channel on your wireless router (Auto or Channel 6 is best). Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    4. Go into your router security settings and change from WEP to WPA with AES.
    5.  Renew IP Address: (especially if you are droping internet connection)
        •    Launch Settings app
        •    Tap on Wi-Fi
        •    Tap on the blue arrow of the Wi-Fi network that you connect to from the list
        •    In the window that opens, tap on the Renew Lease button
    6. Potential Quick Fixes When Your iPad Won’t Connect to Your Wifi Network
    http://ipadinsight.com/ipad-tips-tricks/potential-quick-fixes-when-your-ipad-won t-connect-to-your-wifi-network/
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    Fix WiFi Issue for iOS 7
    http://ipadnerds.com/fix-wifi-issue-ios-7/
    Fix WiFi Issue for iOS 7
    http://ipadnerds.com/fix-wifi-issue-ios-7/
    iOS 6 Wifi Problems/Fixes
    Wi-Fi Fix for iOS 6
    https://discussions.apple.com/thread/4823738?tstart=240
    How To: Workaround iPad Wi-Fi Issues
    http://www.theipadfan.com/workaround-ipad-wifi-issues/
    Another Fix For iOS 6 WiFi Problems
    http://tabletcrunch.com/2012/10/27/fix-ios-6-wifi-problems-ssid/
    Wifi Doesn't Connect After Waking From Sleep - Sometimes increasing screen brightness prevents the failure to reconnect after waking from sleep. According to Apple, “If brightness is at lowest level, increase it by moving the slider to the right and set auto brightness to off.”
    Fix For iOS 6 WiFi Problems?
    http://tabletcrunch.com/2012/09/27/fix-ios-6-wifi-problems/
    Did iOS 6 Screw Your Wi-Fi? Here’s How to Fix It
    http://gizmodo.com/5944761/does-ios-6-have-a-wi+fi-bug
    How To Fix Wi-Fi Connectivity Issue After Upgrading To iOS 6
    http://www.iphonehacks.com/2012/09/fix-wi-fi-connectivity-issue-after-upgrading- to-ios-6.html
    iOS 6 iPad 3 wi-fi "connection fix" for netgear router
    http://www.youtube.com/watch?v=XsWS4ha-dn0
    Apple's iOS 6 Wi-Fi problems
    http://www.zdnet.com/apples-ios-6-wi-fi-problems-linger-on-7000004799/
    ~~~~~~~~~~~~~~~~~~~~~~~
    How to Boost Your Wi-Fi Signal
    http://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Boost-Your-Wi-Fi-Signal.h tm
    Troubleshooting a Weak Wi-Fi Signal
    http://ipad.about.com/od/iPad_Troubleshooting/a/Troubleshooting-A-Weak-Wi-Fi-Sig nal.htm
    How to Fix a Poor Wi-Fi Signal on Your iPad
    http://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Fix-A-Poor-Wi-Fi-Signal-O n-Your-iPad.htm
    iOS Troubleshooting Wi-Fi networks and connections  http://support.apple.com/kb/TS1398
    iPad: Issues connecting to Wi-Fi networks  http://support.apple.com/kb/ts3304
    WiFi Connecting/Troubleshooting http://www.apple.com/support/ipad/wifi/
    How to Fix: My iPad Won't Connect to WiFi
    http://ipad.about.com/od/iPad_Troubleshooting/ss/How-To-Fix-My-Ipad-Wont-Connect -To-Wi-Fi.htm
    iOS: Connecting to the Internet http://support.apple.com/kb/HT1695
    iOS: Recommended settings for Wi-Fi routers and access points  http://support.apple.com/kb/HT4199
    How to Quickly Fix iPad 3 Wi-Fi Reception Problems
    http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
    iPad Wi-Fi Problems: Comprehensive List of Fixes
    http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
    Connect iPad to Wi-Fi (with troubleshooting info)
    http://thehowto.wikidot.com/wifi-connect-ipad
    10 Ways to Boost Your Wireless Signal
    http://www.pcmag.com/article2/0,2817,2372811,00.asp
    Fix iPad Wifi Connection and Signal Issues  http://www.youtube.com/watch?v=uwWtIG5jUxE
    Fix Slow WiFi Issue https://discussions.apple.com/thread/2398063?start=60&tstart=0
    How To Fix iPhone, iPad, iPod Touch Wi-Fi Connectivity Issue http://tinyurl.com/7nvxbmz
    Unable to Connect After iOS Update - saw this solution on another post.
    https://discussions.apple.com/thread/4010130
    Note - When troubleshooting wifi connection problems, don't hold your iPad by hand. There have been a few reports that holding the iPad by hand, seems to attenuate the wifi signal.
    Some Wi-Fi losses may stem from a problematic interaction between Wi-Fi and cellular data connections. Numerous users have found that turning off Cellular Data in Settings gets their Wi-Fi working again.
    You may have many apps open which can possibly cause the slowdown and possibly the loss of wifi. In iOS 4-6 double tap your Home button & at the bottom of the screen you will see the icons of all open apps. Close those you are not using by pressing on an icon until all icons wiggle - then tap the minus sign. For iOS 7 users, there’s an easy way to see which apps are open in order to close them. By double-tapping the home button on your iPhone or iPad, the new multitasking feature in iOS 7 shows full page previews of all your open apps. Simply scroll horizontally to see all your apps, and close the apps with a simple flick towards the top of the screen.
    Wi-Fi or Bluetooth settings grayed out or dim
    http://support.apple.com/kb/TS1559
    ~~~~~~~~~~~~~~~
    If any of the above solutions work, please post back what solved your problem. It will help others with the same problem.
     Cheers, Tom

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

  • How to close database connections in Crystal Reports

    I am using the following code to connect to database. I can either pass JNDIName or I can provide values for others by leaving JNDI name empty.
    If i use JNDI name, it will use a connection from the connection pool of App Server (in my case Weblogic), but it is not releasing the connection after use. Connection remains even if I logoff from the application. If i keep my max connections as 15 in weblogic, after clicking the page with crystal report 15 times all will remain active and users will not be able to login to the application.
    If i use connectionString and others without using JNDI Name, it directly connects to database. So it creates a connection in database server directly without using connection pool of weblogic. If i check weblogic, it shows no connection in use as expected, but if i check database, i can see the no. of connections increasing everytime a user clicks a crystal report page.
    When the connection touches the maximum allowed connection in server, every application using the same server goes down
    How can I close the connection which was created for the viewing the report?
    String reportName = "/reports/BankBalance.rpt";
    ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);
    if (clientDoc == null)
             clientDoc = new ReportClientDocument();
             clientDoc.setReportAppServer(ReportClientDocument.inprocConnectionString);
            // Open report
            clientDoc.open(reportName, OpenReportOptions._openAsReadOnly);
           String connectString = ""; // jdbc:sybase:Tds:DBSERVERNAME:9812/DBNAME?ServiceName=DBNAME
           String driverName = "";    // com.sybase.jdbc3.jdbc.SybDriver
           String JNDIName = "DS_APP";
           String userName = "";
           String password = "";
           // Switch all tables on the main report and sub reports
           CRJavaHelper.changeDataSource(clientDoc, userName, password, connectString, driverName, JNDIName);
         // logon to database
          CRJavaHelper.logonDataSource(clientDoc, userName, password);
    // Store the report document in session
    session.setAttribute(reportName, clientDoc);
                   // Create the CrystalReportViewer object
                          CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();
         String reportSourceSessionKey = reportName+"ReportSource";
         Object reportSource = session.getAttribute(reportSourceSessionKey);
         if (reportSource == null)
              reportSource = clientDoc.getReportSource();
              session.setAttribute(reportSourceSessionKey, reportSource);
         //     set the reportsource property of the viewer
         crystalReportPageViewer.setReportSource(reportSource);
         crystalReportPageViewer.setHasRefreshButton(true);
         crystalReportPageViewer.setToolPanelViewType(CrToolPanelViewTypeEnum.none);
         // Process the report
         crystalReportPageViewer.processHttpRequest(request, response, application, null);

    the sample shows how to clear RAS and Enterprise resources after viewing report.
    1. If you use unmanaged RAS - as I can see you using setReportAppServer, then remove the enterprise related stuff : instantiating and cleaning code.
    The sample code is meant to give you an idea on how you can release the resources after done with viewing report. In your case all you need to do for cleaning is call close() on ReportDocumentObject. The sample will need to be modified for your requirements.

  • Don't know how to fix this - status says no internet connection, yet I'm on the internet.

    So this is a weird one.
    I got this new MacBook Air and the WiFi started up without a hitch.  I had finished migrating from my old computer to my new one and all of a sudden the status bar signal went from full bars to an exclamation point.  The info says Alert: No Internet Connection, yet I am on the internet at full speed.  Even though I have restarted several times, the status in the status bar remains the same.  Since internet is running smoothly, part of me says to forget about it, but it bothers me.
    Does anyone have an idea on how to fix this issue without ruining my internet connectivity on this computer?
    Thanks!

    Migration may have corrupted the network preferences ..
    Open the Finder. From the Finder menu bar click Go > Go to Folder
    Type or copy paste the following:
    /Library/Preferences/SystemConfiguration
    Click Go then move all the files in the SystemConfiguration folder to the Trash.
    See if that makes a difference.
    Your Mac will generate a new SystemConfiguration folder for you.

  • How do I close a connection when the session ends?

    I have a website that is using JavaMail to display a user's mail through the browser. I'd like to keep the connection to the mail server open during the whole session that the user is logged in, in order to improve response time. The problem is, I can't detect if a user closes their browser so that I can close the connection to the server.
    Is there a way for me to close the mail server connection when the session ends?
    Thanks.

    Create session listener, Impliment sessionDestryoyed
    method with your connection close statements.I was wondering how to use the listener for a Servlet as well, what would you type in that method to close the connection?.
    public class ServletListener
         implements
              ServletContextListener,
              ServletContextAttributeListener,
              HttpSessionListener,
              HttpSessionAttributeListener
    public void sessionDestroyed(HttpSessionEvent arg0)
              //System.out.println( arg0 );
    }

  • 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 close timeout  connection in SQLDBC ?

    Hello,
    I use SQLDBC to access MAXDB 7.7.0.7.16 database, i have the following issue :
    When a connection reach timeout, I close the connection, and the release the connexion, and then I create a new connection
    To close connection I call my Disconnect function
                        The call close method return "Not connected", but It seems that the underlying Socket is not closed and the Database user task is not closed.
    So the number of task grow until it reach the maximun.
    Where is my error ?
    How can I be sure to close the database user task ?
    IDBError CMaxDBConnection::Disconnect()
         IDBError hr;
         if (m_pConnection)          
              EDPTRACE_DBG_INF(L"CMaxDBConnection::Disconnect %1", EDPMASK_TRC_CONNECTIONS) << (DWORD)m_pConnection;
              SQLDBC_Retcode rc = m_pConnection->close();
              if (SQLDBC_OK != rc)
                   hr = convertError(rc, m_pConnection->error(), L"CMaxDBConnection::Disconnect");               
              m_pParent->m_pEnvironment->releaseConnection(m_pConnection);
              m_pConnection = NULL;
         return hr;
    Regards
    Yann

    MAXDB 7.7.07.16 (WINDOWS 2008 R2 (64 bits) Client program in 32bits.
    Hello
    I have code a small program to illustrate my issue.
    When I create a connection with SQLDBC it create 2 user tasks in the MAXDB task Manager
    One uer task  APPPLICATION SERVER, SESSION TIMOUT, ... filled.
    T425  10 0x16AC User      2688* Command wait        823 0            76 20691065(s)
    and One User task with no session tiemout.
    T111   8 0x15B8 User       2688 Command wait       3009 0            76 24900501(s)
    T111                  USER             ( pid = 2688       ) -
    dispatcher_cnt: 2                                     command_cnt   : 2
    exclusive_cnt : 30                                    self_susp_cnt : 0
    state_vwait   : 0          state_vsleep  : 0          state_vsusp   : 0
    same_ukt_coll : 0        
    when I close the connection the task T111 is never remove !!
    Do you have any idea ?
    I try to delete environment but It does not work.
    Regards
    Yann.
    Here is the code  :
    // SQLDBC.cpp : Defines the entry point for the console application.
    #include "stdafx.h"
    #include "SQLDBC.h"
    using namespace SQLDBC;
    static void parseArgs(int argc, wchar_t **argv);
    static SQLDBC_Connection *connectDB();
    SQLDBC_Environment *g_env;
    typedef struct ConnectArgsT {
      bstrt username;
      bstrt password;
      bstrt dbname;  
      bstrt host;    
      bstrt request;    
    } ConnectArgsT;
    ConnectArgsT connectArgs;
    void exitOnError(SQLDBC_ErrorHndl &err);
    int _tmain(int argc, _TCHAR* argv[])
         SQLDBC_Retcode ret;
       parseArgs(argc, argv);
       for (int j = 0 ; j < 10 ; ++j)
            for (int i = 0 ; i < 100 ; ++ i)
                 SQLDBC_Connection *conn = connectDB();
                 ret = conn->close();
                 ret = conn->disconnect();
                 g_env->releaseConnection(conn);
            delete g_env;
            g_env = NULL;
       return 0;
    SQLDBC_Connection *connectDB()
      char errorText[200];
      SQLDBC_Retcode rc;
      if (g_env == NULL)
    Every application has to initialize the SQLDBC library by getting a
    reference to the ClientRuntime and calling the SQLDBC_Environment constructor.
           SQLDBC_IRuntime *runtime;      
           runtime = SQLDBC::GetClientRuntime(errorText, sizeof(errorText));
           if (!runtime) {
              fprintf(stderr, "Getting instance of the ClientRuntime failed %s\n", errorText);          
           g_env = new SQLDBC_Environment(runtime);      
    Create a new connection object and open a session to the database.
      SQLDBC_Connection *conn = g_env->createConnection();
      printf("Connecting to '%s' on '%s' as user '%s'\n",
             (char)connectArgs.dbname, (char)connectArgs.host, (char*)connectArgs.username);
      rc = conn->connect(connectArgs.host, connectArgs.dbname,
                         connectArgs.username, connectArgs.password);
      if(SQLDBC_OK != rc) {
        fprintf(stderr, "Can't connect to '%s'.\nERROR: %d:'%s'\n",
                connectArgs.dbname, conn->error().getErrorCode(), conn->error().getErrorText());
        exit(1);
         conn->setAutoCommit(SQLDBC_TRUE);
      return conn;
    static void parseArgs (int argc, wchar_t **argv)
      connectArgs.username = "ESKDBADM";
      connectArgs.password = "DELORME";
      connectArgs.dbname = "EDP350";
      connectArgs.host = "ly-delorme"; 
    void exitOnError(SQLDBC_ErrorHndl &err)
      if(err) {
        fprintf(stderr, "Execution stopped %d:'%s'", err.getErrorCode(), err.getErrorText());
        //exit(1);
    Yann.

  • How do I close all connections to a schema ??

    Hello there,
    I got to drop the existing user. When I tried to DROP USER <user name> CASCADE, it displayed a message that read cannot drop a user with existing connections.
    I have killed all sessions that are open to this schema.. Still I am facing this problem?
    How do I know those connections and how do I close them ???

    Did I say that? Read my post again.
    It says
    First of all, change the password for that user to make sure that no one can connect to that user. Then kill all sessions of that user

  • Using LabVIEW 6i w Win NT or 95/98 et al: how do you keep a TCP/IP open connection 'open'. The application closes the connection even though the refnum is still active (valid.)

    Actually, I open the TCP/IP connection and pass the connection ID through. Each command to/from (cycle) the UUT successfully executes. The refnum for the connection ID is then passed via a shift register in the while loop. i am using the type cast (4X) function to determine the validity of the connection and case statements. If the refnum is non-zero it assumes the connection is still open; if the result is zero, then the connection is closed and a new session opened in that case. What is happening is that the connection has closed and the refnum is still nonzero after the type cast function; su
    bsequent commands to the UUT then produce Error 1 for the TCP/IP function (there was no open connection, so there could be no write occurrence.) Obviously, this probably shouldn't be happening. If someone can give me some idea of what I am not doing, or am doing wrong, I sure would appreciate it. In the event that I open and close a connection for each command to(from)(cycle) the UUT everything works. It is extremely slow. The connection should remain open according to all the pointers in the Help and TCP/IP function descriptions. Some of this application is proprietary, so not sure how much of an example I could use to illustrate from a VI, but if this doesn't get any where, I will see what i can do to better illustrate the problem...Thanks. T.Raper

    I believe this is a related question. I am developing a LV application the uses TCP/IP to control up to 8 devices-under-test (DUT) at one time. They start and finish testing at arbitrary times relative to each other, and the IP addresses are not known until the DUT arrives. I have some question on what is the best way to manage the TCP/IP handles.
    Presently, I have 8 Global IP addresses (one per testing site) that are updated as DUTs arrive and depart, and then whenever I need to communicate with a DUT I use TCP-Open, Write/Read, and TCP-Close. I do this Open/Write/Close each time there is a message to be sent to a DUT. This is basically working, but I notice that the OS (Windows XP or 2000) is running through local TCP/IP ports at a ferocious rate due to the TIME_WAIT behavior of Closed TCP/IP ports (It takes many minutes for a local port to become available again after being closed). If I am not careful, I can quickly exhaust the pool of OS ports by using tight polling loops or other very quick DUT accesses. I have tried not to do that in order to avoid running out of handles, but it is still very wasteful of ports.
    While it is working, I feel so dirty burning through these handles like this since they appear to be a precious resource. I really cannot easily merge multiple Read/Writes into a single Open/Close since there are dozens of otherwise unrelated tests that communicate with the DUT as a part of their functionality. The tests are even in different subVI's that are accessed via a vi-server, and only one is loaded at a time.  
    I thought that a cute idea would be to cache the handles in Globals, and wrap the Open to use the cache if valid, but reading this thread is making me think it is a lot of effort -- I believe I would need to keep a VI running as a "IP Connection Server" at all times and use some form of messaging to get it to Open/Close TCP connections as needed. Since the DUTs arrive at aribitrary times, and with random IP addresses, I cannot establish all the TCP handles ahead of time -- they would need to be created dynamically. It is much more difficult than simply keeping the Connection IDs in global variables -- the VI that Opened them must not be allowed to terminate.
    So... I am curious...... is it really that bad to Open/Close as frequently as I am doing it? Does it make me a bad person? I understand it is inefficient use of time, but the simplicity it brings to the structure seems huge, and the DUT is very slow anyway. And if it is bad, are they any more recent thoughts on alternatives? Do VISA handles behave the same way as TCP handles (ie. auto-close themselves upon exit of the VI that Opened them) ?
    Message Edited by Mike Seibel on 11-28-2005 07:55 PM
    Message Edited by Mike Seibel on 11-28-2005 08:00 PM
    Message Edited by Mike Seibel on 11-28-2005 08:01 PM

  • How to close RFC connection in one script coding

    In one script, I am using the REF command to call another 2 scripts and these called scripts shd be run on same C36 ( test system). I shd close RFC connection between these 2 scripts.
    That is , once the 1s script over the RFC shd be closed and the user has to give usename and pwd  then  2nd script shd run.
    I have tried with the following code…. But it says RFC is not open……
    REF ( Y04S_FC_RM_CJ88_112 , Y04S_FC_RM_CJ88_1 , C36_999 ).   (when execute this script RFC to C36 will be created and after execution that RFC shd be closed so I included following ABAP code)
    ABAP.
      data : dest type RFCDEST.
      move 'S4_SAPC36999' to dest.                                       
      move dest to v_dest.
    *--Close the connection before opening it incase it is opened
              call function 'RFC_CONNECTION_CLOSE'
                   exporting
                        destination          = dest
                   exceptions
                        destination_not_open = 1
                        others               = 2.
              if sy-subrc <> 0.
              endif.
              move sy-subrc to v_subrc.
    ENDABAP.
    REF ( Y04S_FC_RM_CJ44_112 , Y04S_FC_RM_CJ44_1 , C36_999 ). (here agagin the RFC will be created and this script will be exectued.)

    In one script, I am using the REF command to call another 2 scripts and these called scripts shd be run on same C36 ( test system). I shd close RFC connection between these 2 scripts.
    That is , once the 1s script over the RFC shd be closed and the user has to give usename and pwd  then  2nd script shd run.
    I have tried with the following code…. But it says RFC is not open……
    REF ( Y04S_FC_RM_CJ88_112 , Y04S_FC_RM_CJ88_1 , C36_999 ).   (when execute this script RFC to C36 will be created and after execution that RFC shd be closed so I included following ABAP code)
    ABAP.
      data : dest type RFCDEST.
      move 'S4_SAPC36999' to dest.                                       
      move dest to v_dest.
    *--Close the connection before opening it incase it is opened
              call function 'RFC_CONNECTION_CLOSE'
                   exporting
                        destination          = dest
                   exceptions
                        destination_not_open = 1
                        others               = 2.
              if sy-subrc <> 0.
              endif.
              move sy-subrc to v_subrc.
    ENDABAP.
    REF ( Y04S_FC_RM_CJ44_112 , Y04S_FC_RM_CJ44_1 , C36_999 ). (here agagin the RFC will be created and this script will be exectued.)

  • Excessive Port 80 TCP Connections?  How many connections are normal?

    Hi. I'm running MacOS X 10.3.9 on a Mac Powerbook (with all of Apple's latest Security Updates installed. It is a virgin installation and no other software programs have been installed). I then installed Norton Personal Firewall 3.0.2 in order to monitor all my ports.
    By default, Norton Personal Firewall (NPF) is not set to log the number of outgoing connections for port 80, although port 80 is the port typically used by most web browsers to contact other sites on the web. If you disable port 80, then your browser will not be able to function or access the web. Therefore it is mandatory that you leave that port open. But what if some unknown hacker wrote a Trojan program to specifically ferry information out of your computer and back to him using that port, then there'd be no way to stop it once the Trojan was in place. If you disabled the port to prevent it, then you'd also disable yourself from the web. If you opened the port for your browser, then the trojan would have free and open access. At least that is the theory that has me wondering about the seemingly high number of outgoing port 80 connections displayed in my NPF logging window. Therefore, I'd very much like to find out if other users who are running a version of Panther with NPF are experiencing the same high connections behavior on port 80.
    To create the scenario for this behavior, basically you just open your NPF panel and enable all logging for port 80 (by default it is disabled). For those of you who don't specifically know how to do this, the following is the directions . . .
    . . . Open your NPF Service Settings pane. From this pane, highlight the service called Web Sharing Port 80. Click the Edit button at the bottom of the selection window. A new pane will then show the controls named Ports, Logging, and Notification. Bring forward the Logging controls and enable both checkboxes for Allowed and Denied for the Outgoing direction. Click Save and close the window.
    Once the above is done, close all other windows and open your NPF Logging window on your desktop and keep it visible for you to look at. Clear all existing entries in the log so you'll start with a clean slate. With everything set up and a web connection available, open your Safari browser (or any browser) to an online web site. On my computer, my Safari bowser is set to open to Apple's website - www.apple.com. Once the browser is open, Apple's website is then displayed.
    The result . . . surprisingly, after only a few seconds, a HUGE number of port 80 TCP connections to that website address start to show up and flow into my log. In a matter of only 3 or 4 seconds, at least 250 separate TCP connection entries will show up in my log, and they all have the same web address. If I then click on anything on the page or surf to any other website, the log entries will change to the new site address and start up again, and in some cases, in a matter of less than a minute the number of entries can easily reach into the thousands. I've seen 20,000 entries or more flow into my log after a couple of minutes. And the only way to stop the madness and the entries is to disconnect from the web. Those many entries and this behavior does not seem normal to me, no matter what port is selected and no matter what log settings are enabled. A dozen to 15 or 20 entries for a given site I can understand (I've been told some browsers can open at least 10 connections at a time), but hundreds to thousands, I cannot. I can't understand why any program under any circumstance would need to generate those many log entries in such a short time frame. My problem is I have nothing to compare this data to, I only have my suspicions and have no way of knowing whether this behavior is normal or not. So I am asking for others to make a comparison on their computer if you are running any version of Panther and Norton Personal Firewall and give me your results so I can determine what is normal or not. I've heard of certain hacker attacks called TCP flooding and other forms of attacks, and I don't want my computer to have been secretly taken over by a hacker or the initiator of such attacks unknowingly. Furthermore, this is not anything an average user would even normally notice, simply because Port 80 logging is not usually enabled in NPF. Nevertheless, I need to find out the root of this problem and learn whether this is normal. Other than these high number of connection entries, my web surfing seems normal and I haven't yet experienced any seeming sluggishness accessing sites. Any help anyone can offer I would appreciate. Thanks to everyone in advance.
    Here are some images of my own settings and results:
    http://homepage.mac.com/starshone/misc/Port80Settings.jpg
    http://homepage.mac.com/starshone/misc/Port80Log.jpg
      Mac OS X (10.3.9)  

    But all those connections are how the web works. Each HTML page has dozens or more links. Each graphic or other page element is a new HTTP request on port 80 back to the originating server (or another server even). So it's normal to have a lot of port 80 connections going out if you surf the web.
    You can see the individual elements that make up a page in Safari by going to the "Window" menu and showing the "Activity" window. I see CNN's web site tonight has 113 items on its home page. Apple's is 41. My home page is 10. So it's easy to get a lot of connections.
    Some applications also use port 80 to check for updates, so you might see the occasional port 80 connection even when you're not surfing the web. These are also nothing to worry about.
    charlie

  • Open and close RFC connection with portals...

    Hi Experts,
    I created a RFC having a query which is taking a long time to execute. So i want to close RFC connection with portals which is via java connector(JCO)  before that query and open the connction again after that query.
    Please advice is it possible to achieve this. If yes, then how.
    Regards,
    Guddan

    Hi Guddan,
    I created a RFC having a query which is taking a long time to execute. So i want to close RFC connection with portals which is via java connector(JCO) before that query and open the connction again after that query.
    I guess i will need to understand your requirement a little more in detail, as i understand you have an RFC which has a query within to fetch some data and is taking a long time to do so. In the meantime you don't want to keep the connection open?
    My question would be, Is the role of this RFC to only execute the query and fetch the data or does it do something else?
    If it does other things and these are independent of the query execution, then you can span a parallel call within the RFC to execute the query and in the meantime the RFC does the other things (or vice versa) hence reducing the overall time taken.
    If the sole purpose of this RFC is to execute the query, then you will not be able(i mean to say there is no simple and direct way of doing this) to close the connection after the Query is started and re-establish the connection after its execution, for a simple reason that - how will you know if the query has completed it's execution, so that you can establish the connection back.
    Alternate solutions, make this a two way asynchronous call, 1) You invoke the RFC asynchronously and close the connection, the RFC in turn will execute the query and transfer the data to JCO via another RFC call.
    If this needs to be a synchronous call, then you will need to optimize the query to its best.
    Regards,
    Chen

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

  • Geting "Incorrect client ID.The stub is not connected yet" during deploying

    Hai all,
          I am unable to deploy a J2EE application from Deploy Tool. The following trace is comg in defaultTrace.trc.2
    #1.5#000D9D9FAF62003C0000000900000F080003FC0472DB309D#1121520967258#com.sap.engine.services.rmi_p4##com.sap.engine.services.rmi_p4#Guest#2##sap_J2E_1009250#Guest#097b3220f5fd11d9b557000d9d9faf62#Finalizer##0#0#Error#1#/System/Server#Plain#ID:Can't send inform message.: Incorrect client ID. The stub is not connected yet.#com.sap.engine.services.monitor.mbeans.MonitorResourceBundle##
    #1.5#000D9D9FAF62003C0000000A00000F080003FC0472DB33DE#1121520967258#com.sap.engine.services.rmi_p4##com.sap.engine.services.rmi_p4#Guest#2##sap_J2E_1009250#Guest#097b3220f5fd11d9b557000d9d9faf62#Finalizer##0#0#Error#1#/System/Server#Plain###Incorrect client ID. The stub is not connected yet.#
    #1.5#000D9D9FAF62003C0000000B00000F080003FC0472DB3A15#1121520967258#com.sap.engine.services.rmi_p4##com.sap.engine.services.rmi_p4.com.sap.engine.services.rmi_p4.StubImpl p4_finalize#Guest#2##sap_J2E_1009250#Guest#097b3220f5fd11d9b557000d9d9faf62#Finalizer##0#0#Error##Plain###
    com.sap.engine.services.rmi_p4.exception.P4BaseIOException: Incorrect client ID. The stub is not connected yet.
         at com.sap.engine.services.rmi_p4.server.P4ObjectBrokerServerImpl.getException(P4ObjectBrokerServerImpl.java:860)
         at com.sap.engine.services.rmi_p4.server.P4ObjectBrokerServerImpl.getException(P4ObjectBrokerServerImpl.java:853)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.reply(P4SessionProcessor.java:169)
         at com.sap.engine.services.rmi_p4.StubImpl.p4_finalize(StubImpl.java:221)
         at com.sap.engine.services.rmi_p4.StubBase.finalize(StubBase.java:121)
         at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
         at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
         at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
         at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)
    #1.5#000D9D9FAF62003C0000000C00000F080003FC0472DB3F36#1121520967258#com.sap.engine.services.rmi_p4##com.sap.engine.services.rmi_p4#Guest#2##sap_J2E_1009250#Guest#097b3220f5fd11d9b557000d9d9faf62#Finalizer##0#0#Error#1#/System/Server#Plain#ID:Can't send inform message.: Incorrect client ID. The stub is not connected yet.#com.sap.engine.services.monitor.mbeans.MonitorResourceBundle##
    #1.5#000D9D9FAF62003C0000000D00000F080003FC0472DB423D#1121520967258#com.sap.engine.services.rmi_p4##com.sap.engine.services.rmi_p4#Guest#2##sap_J2E_1009250#Guest#097b3220f5fd11d9b557000d9d9faf62#Finalizer##0#0#Error#1#/System/Server#Plain###Incorrect client ID. The stub is not connected yet.#
    #1.5#000D9D9FAF62003C0000000E00000F080003FC0472DB47AA#1121520967258#com.sap.engine.services.rmi_p4##com.sap.engine.services.rmi_p4.com.sap.engine.services.rmi_p4.StubImpl p4_finalize#Guest#2##sap_J2E_1009250#Guest#097b3220f5fd11d9b557000d9d9faf62#Finalizer##0#0#Error##Plain###
    com.sap.engine.services.rmi_p4.exception.P4BaseIOException: Incorrect client ID. The stub is not connected yet.
         at com.sap.engine.services.rmi_p4.server.P4ObjectBrokerServerImpl.getException(P4ObjectBrokerServerImpl.java:860)
         at com.sap.engine.services.rmi_p4.server.P4ObjectBrokerServerImpl.getException(P4ObjectBrokerServerImpl.java:853)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.reply(P4SessionProcessor.java:169)
         at com.sap.engine.services.rmi_p4.StubImpl.p4_finalize(StubImpl.java:221)
         at com.sap.engine.services.rmi_p4.StubBase.finalize(StubBase.java:121)
         at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
         at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
         at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
         at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)
    #1.5#000D9D9FAF62003B0000000100000F080003FC047395DF47#1121520979492#com.sap.engine.compilation##com.sap.engine.compilation.ExternalCompiler.compile()#Administrator#32###Administrator#8c8d9e90f5fe11d99d3d000d9d9faf62#SAPEngine_Application_Thread[impl:3]_32##0#0#Error##Plain###Error while compiling :
    java.io.IOException: CreateProcess: javac -encoding Cp1252 -d C:/usr/sap/J2E/JC00/j2ee/cluster/server0/apps/sap.com/onlyear/EJBContainer/temp/temp1121520967445 -classpath .;./bin/system/frame.jar;C:/usr/sap/J2E/JC00/j2ee/cluster/server0/bin/ext/jms/jms.jar;C:/usr/sap/J2E/JC00/j2ee/cluster/server0/bin/ext/tcsecssl/iaik_jsse.jar;C:/usr/sap/J2E/JC00/j2ee/cluster/server0/bin/ext/webservices_lib/saaj-api.jar;C:/usr/sap/J2E/JC00/j2ee/cluster/server0/bin/ext/tcsecssl/iaik_smime.jar;C:/usr/sap/J2E/JC00/j2ee/cluster/server0/bin/ext/add_ejb/add_ejb.jar;C:/usr/sap/J2E/JC00/j2ee/cluster/server0/bin/ext/servlet/servlet.jar;C:/usr/sap/J2E/JC00/j2ee/cluster/server0/bin/services/naming/naming.jar;C:/usr/sap/J2E/JC00/j2ee/cluster/server0/bin/ext/webservices_lib/webservices_lib.jar;C:/usr/sap/J2E/JC00/j2ee/cluster/server0/bin/interfaces/resourcecontext_api/resourcecontext_api.jar;C:/usr/sap/J2E/JC00/j2ee/cluster/server0/bin/ext/tcsecssl/w3c_http.jar;C:/usr/sap/J2E/JC00/j2ee/cluster/server0/bin/interfaces/webservices/webservices_api.jar;C:/us?
         at java.lang.Win32Process.create(Native Method)
         at java.lang.Win32Process.<init>(Win32Process.java:66)
         at java.lang.Runtime.execInternal(Native Method)
         at java.lang.Runtime.exec(Runtime.java:566)
         at java.lang.Runtime.exec(Runtime.java:491)
         at java.lang.Runtime.exec(Runtime.java:457)
         at com.sap.engine.compilation.ExternalCompiler.compile(ExternalCompiler.java:65)
         at com.sap.engine.services.ejb.util.AdminUtils.compile(AdminUtils.java:449)
         at com.sap.engine.services.ejb.deploy.DeployAdmin.deploySingleJar(DeployAdmin.java:625)
         at com.sap.engine.services.ejb.deploy.DeployAdmin.generate(DeployAdmin.java:266)
         at com.sap.engine.services.ejb.EJBAdmin.deploy(EJBAdmin.java:2093)
         at com.sap.engine.services.deploy.server.application.DeploymentTransaction.makeComponents(DeploymentTransaction.java:1015)
         at com.sap.engine.services.deploy.server.application.DeploymentTransaction.begin(DeploymentTransaction.java:594)
         at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:300)
         at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhases(ApplicationTransaction.java:331)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.makeGlobalTransaction(DeployServiceImpl.java:2910)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.deploy(DeployServiceImpl.java:451)
         at com.sap.engine.services.deploy.server.DeployServiceImplp4_Skel.dispatch(DeployServiceImplp4_Skel.java:1511)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:286)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:172)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:104)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:140)
    #1.5#000D9D9FAF62003B0000000900000F080003FC04739BCB45#1121520979883#com.sap.engine.services.rmi_p4##com.sap.engine.services.rmi_p4#Administrator#32###Administrator#8c8d9e90f5fe11d99d3d000d9d9faf62#SAPEngine_Application_Thread[impl:3]_32##0#0#Error##Plain###com.sap.engine.services.rmi_p4.DispatchImpl _runInternal Cannot deploy application sap.com/onlyear..
    Reason: Exception during generation of components of application sap.com/onlyear in container EJBContainer.; nested exception is:
         com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Exception during generation of components of application sap.com/onlyear in container EJBContainer.#
    #1.5#000D9D9FAF62003B0000000A00000F080003FC04739BD41D#1121520979883#com.sap.engine.services.rmi_p4##com.sap.engine.services.rmi_p4.com.sap.engine.services.rmi_p4.DispatchImpl runInternal#Administrator#32###Administrator#8c8d9e90f5fe11d99d3d000d9d9faf62#SAPEngineApplication_Thread[impl:3]_32##0#0#Error##Plain###
    java.rmi.RemoteException: Cannot deploy application sap.com/onlyear..
    Reason: Exception during generation of components of application sap.com/onlyear in container EJBContainer.; nested exception is:
         com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Exception during generation of components of application sap.com/onlyear in container EJBContainer.
         at com.sap.engine.services.deploy.server.DeployServiceImpl.deploy(DeployServiceImpl.java:466)
         at com.sap.engine.services.deploy.server.DeployServiceImplp4_Skel.dispatch(DeployServiceImplp4_Skel.java:1511)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:286)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:172)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:104)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:140)
    Caused by: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Exception during generation of components of application sap.com/onlyear in container EJBContainer.
         at com.sap.engine.services.deploy.server.application.DeploymentTransaction.makeComponents(DeploymentTransaction.java:1021)
         at com.sap.engine.services.deploy.server.application.DeploymentTransaction.begin(DeploymentTransaction.java:594)
         at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:300)
         at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhases(ApplicationTransaction.java:331)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.makeGlobalTransaction(DeployServiceImpl.java:2910)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.deploy(DeployServiceImpl.java:451)
         ... 10 more
    Caused by: java.lang.NullPointerException
         at com.sap.engine.compilation.ExternalCompiler.getErrorMessage(ExternalCompiler.java:123)
         at com.sap.engine.services.ejb.util.AdminUtils.compile(AdminUtils.java:451)
         at com.sap.engine.services.ejb.deploy.DeployAdmin.deploySingleJar(DeployAdmin.java:625)
         at com.sap.engine.services.ejb.deploy.DeployAdmin.generate(DeployAdmin.java:266)
         at com.sap.engine.services.ejb.EJBAdmin.deploy(EJBAdmin.java:2093)
         at com.sap.engine.services.deploy.server.application.DeploymentTransaction.makeComponents(DeploymentTransaction.java:1015)
         ... 15 more
    #1.5#000D9D9FAF62003B0000000D00000F080003FC04739BDA8D#1121520979883#com.sap.engine.services.rmi_p4##com.sap.engine.services.rmi_p4#Administrator#32###Administrator#8c8d9e90f5fe11d99d3d000d9d9faf62#SAPEngine_Application_Thread[impl:3]_32##0#0#Error#1#/System/Server#Plain#ID:011403: Cannot deploy application sap.com/onlyear..
    Reason: Exception during generation of components of application sap.com/onlyear in container EJBContainer.; nested exception is:
         com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Exception during generation of components of application sap.com/onlyear in container EJBContainer.#com.sap.engine.services.monitor.mbeans.MonitorResourceBundle##
    #1.5#000D9D9FAF62003B0000000E00000F080003FC04739BDCAE#1121520979883#com.sap.engine.services.rmi_p4##com.sap.engine.services.rmi_p4#Administrator#32###Administrator#8c8d9e90f5fe11d99d3d000d9d9faf62#SAPEngine_Application_Thread[impl:3]_32##0#0#Error#1#/System/Server#Plain###Cannot deploy application sap.com/onlyear..
    Reason: Exception during generation of components of application sap.com/onlyear in container EJBContainer.; nested exception is:
         com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Exception during generation of components of application sap.com/onlyear in container EJBContainer.#
    #1.5#000D9D9FAF62003B0000000F00000F080003FC04739BDEA3#1121520979883#com.sap.engine.services.rmi_p4##com.sap.engine.services.rmi_p4#Administrator#32###Administrator#8c8d9e90f5fe11d99d3d000d9d9faf62#SAPEngine_Application_Thread[impl:3]_32##0#0#Error##Plain###TraceException in DispatchImpl...#
    #1.5#000D9D9FAF62003B0000001000000F080003FC04739BDFA7#1121520979883#com.sap.engine.services.rmi_p4##com.sap.engine.services.rmi_p4#Administrator#32###Administrator#8c8d9e90f5fe11d99d3d000d9d9faf62#SAPEngine_Application_Thread[impl:3]_32##0#0#Error##Plain###P4:SAPEngine_Application_Thread[impl:3]_32: TraceException in DispatchImpl...#
    The above trace repeating all the time when I try to deploy.
    Can any body tell whether is it a configuration problem or any application problem. Also on the same server another j2ee application is deploying successfully.
    Thanks a lot,
    Gangadhar.

    Hai,
        Thanks Brandelik, actually the problem was coming because of java.lang.outOfMemory exception during compilation time.
         As of now I am not able to fix that problem. I am changing all the available options for memory settings.
        Anybody please help me how to set the memory parameters for deploying an application. My application needs minimum of -Xmx512m for deployment on oracle10g server.
    Thanx,
    Gangadhar.

Maybe you are looking for