MySql with  No operations allowed after connection closed.

Hi all... I want to avoid Too many Connections while accessing db...
can anyone help me to solve this...
bye

Do not cross-post it is considered extremely rude. Stick with the thread in the JDBC forum (which is the right place for this question).
http://forum.java.sun.com/thread.jspa?threadID=5203295

Similar Messages

  • Java.sql.SQLException: No operations allowed after connection closed

    Hi all
    I was trying the jakarta DBCP pool for managing my connections to Mysql(4.0.17-standard ). I let tomcat to manage the pool by specifying datasource in server.xml and web.xml. Everything works fine if there are only a few transactions. But when the number of queries increse, I get an exception like
    java.sql.SQLException: No operations allowed after connection closed.
    Connection was closed explicitly by the application at the following location:
    ** BEGIN NESTED EXCEPTION **
    java.lang.Throwable
    STACKTRACE:
    java.lang.Throwable
            at com.mysql.jdbc.Connection.close(Connection.java:1061)
            at org.apache.commons.dbcp.PoolableConnection.reallyClose(PoolableConnec
    tion.java:124)
            at org.apache.commons.dbcp.PoolableConnectionFactory.destroyObject(Poola
    bleConnectionFactory.java:196)
            at org.apache.commons.pool.impl.GenericObjectPool.returnObject(Unknown S
    ource)
            at org.apache.commons.dbcp.AbandonedObjectPool.returnObject(AbandonedObj
    ectPool.java:140)
            at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.j
    ava:110)
    ......I then tried the Connecion Pool manually with DBCP to check it is a problm with tomcat or ont. Still the exception comes after a few transactions. I re-checked the code and I am closing all connections in finally block. I searched in net for a solution, but couldnt find any. Is that a problm with mysql? has anyone experienced it? Any help will be greatly appreciated
    thanks
    boolee

    Odd that Throwable is the exception logged. What does your finally block actually look like? As an experiment, what happens if you execute the following line of hypothetical code in your 'finally' block?
    finally {
      System.out.println(conn.getClass().getName());
    }- Saish

  • Error "No operations Allowed after statement closed"

    Hi,
    I have a little program that I want to grab a list of names out of MySQL (it does) and when I click on the name I want it to display some information about the person. This is where I run into the error, when I click on a name in the list box it gives me the error "No operations allowed after statement closeed". I'm not sure where my statement is being closed, in my listSelectionListerner I never close the statement so I'm not sure whats heppening. Heres the code:
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.sql.*;
    import java.util.*;
    public class Gifts extends JFrame
         static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
         static final String DATABASE_URL = "jdbc:mysql://localhost/test?user=root&password=root";
       private JList nameList;
         private JTextArea statList;
         private JButton add;
       private Container container;
         private JPanel nameListPanel, statListPanel, buttonPanel;
         private Connection conn;
         private Statement stat;
       public Gifts()
              super( "Spiritual Gift Database" );
              try
                   Class.forName(JDBC_DRIVER);
                   conn = DriverManager.getConnection(DATABASE_URL);
                   stat = conn.createStatement();
                   ResultSet rs = stat.executeQuery("SELECT heading1 FROM demo");
                   Vector vector1 = new Vector();
                   while(rs.next()) vector1.add(rs.getObject(1));
                   container = getContentPane();
               container.setLayout( new FlowLayout() );
                   nameListPanel = new JPanel();
                   statListPanel = new JPanel();
                   buttonPanel = new JPanel();
               nameList = new JList(vector1);
               nameList.setVisibleRowCount( 9 );
                   nameList.setPrototypeCellValue("XXXXXXXXXXXX");
                   nameList.addListSelectionListener(
                        new ListSelectionListener()
                             public void valueChanged(ListSelectionEvent event)
                                  try
                                       ResultSet resultSet = stat.executeQuery("SELECT * FROM demo");
                                       StringBuffer results = new StringBuffer();
                                       ResultSetMetaData metaData = resultSet.getMetaData();
                                       int numberOfColumns = metaData.getColumnCount();
                                       for(int i = 1; i<=numberOfColumns; i++)
                                       results.append(metaData.getColumnName(i) + "\t");
                                       results.append("\n");
                                       while (resultSet.next())
                                            for(int i = 1; i<= numberOfColumns; i++)
                                            results.append(resultSet.getObject(i) + "\t");
                                            results.append("\n");
                                  catch(SQLException sqlException)
                                       JOptionPane.showMessageDialog(null,sqlException.getMessage(),
                                       "Database Error1", JOptionPane.ERROR_MESSAGE);
                                       System.exit(1);
                   statList = new JTextArea(10,20);
                   add = new JButton("Add Entry");
               nameList.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
                   statListPanel.add(new JScrollPane(statList));   
               nameListPanel.add( new JScrollPane(nameList));
                   buttonPanel.add(add);
                   container.add(nameListPanel, BorderLayout.EAST);
                   container.add(statListPanel, BorderLayout.WEST);
                   container.add(buttonPanel);
               setSize( 400, 300 );
               setVisible( true );
              }//end try block
              catch(SQLException sqlException)
                   JOptionPane.showMessageDialog(null,sqlException.getMessage(),
                   "Database Error1", JOptionPane.ERROR_MESSAGE);
                   System.exit(1);
              catch (ClassNotFoundException classNotFound)
                   JOptionPane.showMessageDialog(null, classNotFound.getMessage(),
                   "Driver Not Found", JOptionPane.ERROR_MESSAGE);
                   System.exit(1);
              finally
                   try
                        stat.close();
                        conn.close();
                   catch (SQLException sqlException)
                        JOptionPane.showMessageDialog(null,
                        sqlException.getMessage(), "Database Error2",
                        JOptionPane.ERROR_MESSAGE);
                        System.exit(1);
         }//end Gifts()
       public static void main( String args[] )
          Gifts application = new Gifts();
          application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    }

    The fact is,
    the finally statement is reached after the whole object is initialized,
    that means that your statement is closed, before you make an action
    with you ListSelectionListener.
    Try working with a connect and disconnect method, or something like that,
    which are called during your valueChangeg() method!

  • JDBC + MySQL : "Operation Not Allowed After ResultSet Closed"

    I have a very short piece of code. I use one connection to the database. I execute a query, get back a lot of rows, then iterate through the result set and for each row I get some information and then perform an insert into a different table.
    The problem is that the big result set I am iterating through keeps closing sometime during the first iteration. Why? I am using three different statements:
    1) Statement 1 is for the main query I want to iterate through
    2) Statement 2 is for a quick lookup I perform (on a different table) for each item in the iteration.
    3) Statement 3 is for the Insert statement which I perform for each item in the iteration. Again, I insert into a different table and I use "executeUpdate"
    Given the I have three different statements and I am working with three different tables, why does my main result set that I am iterating through keep closing on me?
    Here is the error I am getting:
    java.sql.SQLException: Operation not allowed after ResultSet closed
    at com.mysql.jdbc.ResultSet.checkClosed(ResultSet.java:3603)
    at com.mysql.jdbc.ResultSet.next(ResultSet.java:2468)
    at com.mysql.jdbc.UpdatableResultSet.next(UpdatableResultSet.java:565)
    Thanks for your help.

    I have a very short piece of code. I use one
    connection to the database. I execute a query, get
    back a lot of rows, then iterate through the result
    set and for each row I get some information and then
    perform an insert into a different table.Sounds like a classic case of making Java do what the database was made to do.
    I'd bet you can do this in a single INSERT with a SELECT in the database in one network roundtrip. The "quick lookup" might be a JOIN or a sub-SELECT. When you do a query, bring N rows back to the middle tier, then do an INSERT for each row that you retrieve it means (N+1) network roundtrips if you don't batch your INSERTs. I'd have a SQL expert give your code a look.
    The problem is that the big result set I am iterating
    through keeps closing sometime during the first
    iteration. Why? I am using three different
    statements:
    1) Statement 1 is for the main query I want to
    iterate through
    2) Statement 2 is for a quick lookup I perform (on a
    different table) for each item in the iteration.
    3) Statement 3 is for the Insert statement which I
    perform for each item in the iteration. Again, I
    insert into a different table and I use
    "executeUpdate"
    Given the I have three different statements and I am
    working with three different tables, why does my main
    result set that I am iterating through keep closing
    on me?Maybe your ResultSet or Statement goes out of scope. Do the Statements share a Connection?
    %

  • I have a MacBook Pro with Snow Leopard. After connecting my HP Photosmart D110 to it, the printer works but the scanner doesn't. The message is"The scan cannot be performed because another program has control of the HP imaging device". Can anyone help?

    I have a MacBook Pro with Snow Leopard. After connecting my HP Photosmart D110 to it, the printer works but the scanner doesn't. The message is"The scan cannot be performed because another program has control of the HP imaging device". Can anyone help?

    Found the answer on the HP site. It's the original software that works with this printer OS X 10.6!!
    http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareDescription.jsp?lang=en &cc=us&prodTypeId=18972&prodSeriesId=3558902&prodNameId=3562006&swEnvOID=219&swL ang=8&mode=2&taskId=135&swItem=ma-60835-3

  • I am unable to get beyond the "sync with iTunes" splash page after connecting my iPhone; every tab is grey. What gives?

    I am unable to get beyond the "sync with iTunes" splash page after connecting my iPhone; every tab is grey. What gives?

    Is the computer the one the device normally syncs with?
    If not, sync with the computer it normally syncs with.
    If it is, place the device in DFU mode (google it) and restore.

  • Idoc with status '03' and having "connection closed" status in SM58

    Dear all,
        We have came across cases where we send out 10 idcos to an external system..using TCP/IP RFC destination. Among these 10 idcos..some of them will remained status '03' and it can be seen at SM58 that these idcos were having the status 'connection closed'. And among these "stuck" idocs, some of them had already received at the target system but some were not. I understand that we can execute LUW at this SM58. But everytime i execute LUW, it will return me message "gateway fail / not found". In order to make this execution of LUW a success, i need to go to SM59, look for the TCP/IP RFC destination, do a test connection to it, then come back to the SM58 to execute the LUW. By doing this, only the IDOC can be sent out and received at the 3rd party system. Any idea what is going on and how should i prevent it? Any other method i can used to let it pass through other than executing it one by one in SM58? Thank you!
    Regards,
    Joan
    Edited by: Joan Lee on Aug 5, 2009 12:07 PM

    Hi Naren,
        Do you have any idea where can i check the RFC downtime in R/3 itself? considering that the basis team said that the connection is up 24/7. thank you.
    Regards,
    Joan

  • What should i do? i do not know what happened with my external hard after connected with mac OS...

    hello...I am new user of mac OS...I connected my external hard with my laptop...After that my hard detected but there is no space and no files, everything. It has only one .exe file but it is giving error...even it is same on Windows...i have some very important documents...
    What should i do?
    please tell me some way to copy my documents...
    thank you...

    OGELTHORPE wrote:
    Poikkeus, greetings:  I suggest that the overwhelming majority of readers of a post can determine the value and quality of the responses and suggestions made, on their own. To ask or coach a person to indicate if the assistance was "helpful" is not necessary and can be viewed as incongruous with the  APPLE SUPPORT COMMUNITIES USE AGREEMENT.
    Please note that I made no judgements as to the quality of your assistance nor did I make any comments or implications regarding your courtesy.  My statement was strictly related to your comment in bold face type (quoted in my prior statement) and nothing more.
    Re yours:  "Everyone wins by learning."  I totally agree with you on that point.
    Ciao.
    Your response is thoughtful and deserves discussion. Moreover, it seems we're in agreement on several issues - but not this one.
    Look through my questions and answers. I have no interest in points or "helpful" ratings. But it's perfectly reasonble and consistent with Apple Support criteria to ask if an issue is resolved to the poster's satisfaction, and to encourage further discussion to make sure it's resolved. The original poster's question in this thread wasn't resolved completely, but further dialog encouraged the user to visit the Apple Store, where it will be addessed. The poster was appreciative for the information.
    Ultimately, it's up to Apple to discern whether my comments are incongruous with Apple's Support Use Agreement. I don't see any incongruity.

  • SFTP MGET of large files fails - connection closed - problem with spool file

    I have a new SFTP job to get files from an FTP Server.  The files are large (80mg, 150mg).  I can get smaller files from the ftp site with no issue, but when attempting the larger files the job completes abnormally after 2 min 1 sec. each time.  I can see the file is created on our local file system with 0 bytes, then when the FTP job fails, the 0 byte file is deleted.
    Is there a limit to how large an ftp file can be in Tidal?  How long an ftp job can run?
    The error in the job audit is Problem with spool file for job XXXX_SFTPGet and an exit code of 127 (whatever that is).
    In the log, the error is that the connection was closed.  I have checked with the ftp host and their logs show that we are disconnecting unexpectedly also.
    Below is an excerpt from the log
    DEBUG [SFTPMessage] 6 Feb 2015 14:17:33.055 : Send : Name=SSH_FXP_STAT,Type=17,RequestID=12
    DEBUG [SSH2Channel] 6 Feb 2015 14:17:33.055 : Transmit 44 bytes
    DEBUG [ChannelDataWindow] 6 Feb 2015 14:17:33.055 : Remote window size decreased to 130808
    DEBUG [PlainSocket] 6 Feb 2015 14:17:33.071 : RepeatCallback received 84 bytes
    DEBUG [SSH2Connection] 6 Feb 2015 14:17:33.071 : ProcessPacket pt=SSH_MSG_CHANNEL_DATA
    DEBUG [SFTPMessageFactory] 6 Feb 2015 14:17:33.071 : Received message (type=105,len=37)
    DEBUG [SFTPMessageStore] 6 Feb 2015 14:17:33.071 : AddMessage(12) - added to store
    DEBUG [SFTPMessage] 6 Feb 2015 14:17:33.071 : Reply : Name=SSH_FXP_ATTRS,Type=105,RequestID=12
    DEBUG [SFTPMessage] 6 Feb 2015 14:17:33.071 : Send : Name=SSH_FXP_OPEN,Type=3,RequestID=13
    DEBUG [SSH2Channel] 6 Feb 2015 14:17:33.071 : Transmit 56 bytes
    DEBUG [ChannelDataWindow] 6 Feb 2015 14:17:33.071 : Remote window size decreased to 130752
    DEBUG [PlainSocket] 6 Feb 2015 14:17:33.087 : RepeatCallback received 52 bytes
    DEBUG [SSH2Connection] 6 Feb 2015 14:17:33.087 : ProcessPacket pt=SSH_MSG_CHANNEL_DATA
    DEBUG [SFTPMessageFactory] 6 Feb 2015 14:17:33.087 : Received message (type=102,len=10)
    DEBUG [SFTPMessageStore] 6 Feb 2015 14:17:33.087 : AddMessage(13) - added to store
    DEBUG [SFTPMessage] 6 Feb 2015 14:17:33.087 : Reply : Name=SSH_FXP_HANDLE,Type=102,RequestID=13
    DEBUG [SFTPMessage] 6 Feb 2015 14:17:33.087 : Send : Name=SSH_FXP_READ,Type=5,RequestID=14
    DEBUG [SSH2Channel] 6 Feb 2015 14:17:33.087 : Transmit 26 bytes
    DEBUG [ChannelDataWindow] 6 Feb 2015 14:17:33.087 : Remote window size decreased to 130726
    DEBUG [PlainSocket] 6 Feb 2015 14:17:33.118 : RepeatCallback received 0 bytes
    DEBUG [SFTPChannelReceiver] 6 Feb 2015 14:17:33.118 : Connection closed:  (code=0)
    ERROR [SFTPMessageStore] 6 Feb 2015 14:17:33.118 : Disconnected unexpectedly ( [errorcode=0])
    ERROR [SFTPMessageStore] 6 Feb 2015 14:17:33.118 : EnterpriseDT.Net.Ftp.Ssh.SFTPException:  [errorcode=0]
    ERROR [SFTPMessageStore] 6 Feb 2015 14:17:33.118 :    at EnterpriseDT.Net.Ftp.Ssh.SFTPMessageStore.CheckState()
    ERROR [SFTPMessageStore] 6 Feb 2015 14:17:33.118 :    at EnterpriseDT.Net.Ftp.Ssh.SFTPMessageStore.GetMessage(Int32 requestId)

    I believe there is a limitation on FTP and what you are seeing is a timeout built into the 3rd party application that tidal uses (I feel like it was hardcoded and it would be a big deal to change but this was before Cisco purchased tidal)  there may have been a tagent.ini setting that tweaks that but I can't find any details.
    We wound up purchasing our own FTP software (ipswitch MOVEit Central & DMZ) because we also had the need to host as well as Get/Put to other FTP sites. It now does all our FTP and internal file delivery activity (we use it's api and call from tidal if we need to trigger inside a workflow)

  • 100% CPU after connecting with RDP

    Hi,
    We have a W2K3 SP2 vmware guest server running in our network. It's a member server. It has only Lotus domino installed.
    But since last week that after connecting via RDP  (doesn't matter to connect to console or any session) or with vwware console that the server CPU peaks 100% and don't allow connecting nor working with  it.
    We have to force shutdown from ESXi host.
    Does anybody know what could be the cause.
    Thanks,

    Hi,
    You may need to use Task Manager, Resource Monitor or Process Explorer to check which process causes 100% CPU usage.
    Thanks.
    Jeremy Wu
    TechNet Community Support

  • After restoring SharePoint farm backup ( The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connection)

    Hi,
    I have taken farm back and restore it in new UAT environment, while access to the main site getting the below error: 
    Error  
    An unexpected error has occurred. 
    Troubleshoot issues with Microsoft SharePoint Foundation. 
    Correlation ID: 866476f3-23dd-4e1e-97af-bffc62cc2d57 
    Date and Time: 7/15/2014 11:26:35 AM 
    When i checked in log i got below error
    System.Data.SqlClient.SqlException: A network-related or instance-specific
    error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40
    - Could not open a connection to SQL Server)    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
    stateObj)     at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecu... 
    Thanks in advance
    Said Al Balushi

    Hi Wendy,
    i have checked all below points, every thing is fine but still i am getting the same error.
    Check SQL services are runing
    Check remote conenctions are enabled
    Check SQL Browser service is runing
    Check TCP/IP protocal enabled at SQL server
    Check out windows firewall setting
    Thanks,
    Said
     

  • Device button no longer appears in iTunes after connecting with USB cable

    Since updating software to OUS 7.0.4 my device buttton no longer appears in the iTunes window after connecting with USB cable

    Problem solved. I needed to reinstall my Apple Mobile Driver.  I found the solution on this web site.
    iOS: Device not recognized in iTunes for Windows http://support.apple.com/kb/YS1538
    After I reinstalled the driver, my iPohne immediately synchronized with my computer. 

  • I have a 3rd generation nano ipod and after connecting it to my mac to sync my calendar, it said it no longer would sync the calendar.  What's up with that???

    I have a 3rd generation nano ipod and after connecting it to my mac to sync my calendar, it said it no longer would sync the calendar.  What's up with that???

    Thanks Bob, I don't know why but it all of a sudden worked a few days later. It's a mystery but at least problem solved.

  • I have tried everything, but still I can't locate the photos tab in iTunes...I have tried changing the resolution, started iTunes after connecting with the ipad2, nothing seems to work! please advise!

    I have tried everything, but still I can't locate the photos tab in iTunes...I have tried changing the resolution, started iTunes after connecting with the ipad2, nothing seems to work! please advise!
    I am also providing you with a screenshot of what appears! I need photos on my iPad2
    Message was edited by: angana

    You don't see it on the left-hand side of iTunes - you need to connect and select the iPad on the left-hand side, and then one of the tabs on the right-hand side that you use to select which content to sync to the iPad should be Photos : http://support.apple.com/kb/HT4236
    You will need to select and sync all the photos that you want on the iPad together in one go as only the most recent sync remains on the iPad, not including photos in a subsequent sync is how you delete them from it.

  • I'm on a windows laptop using iTunes sharing through the family to connect with Apple TV. After choosing the folder of photos to be shared and displayed on the appletv and when I choose to show on screen, they are not shown in the order they are in the or

    I'm on a windows laptop using iTunes sharing through the family to connect with Apple TV.
    After choosing the folder of photos to be shared and displayed on the appletv and when I choose to show on screen, they are not shown in the order they are in the original folder.
    How to pair show in a certain order, for example, sorted by name.
    grateful
    Julio Cesar

    Not that I'm aware of. You just export JPEG copies to a folder that you can point iTunes to. For instance, I have created a folder in my Pictures folder called Apple TV. And within that folder I have other folders of pictures that I can choose from in iTunes to share with Apple TV. But there doesn't seem to be any way to share a Lightroom slideshow. If you have laid to create a video file that would probably work. Apple TV is a little clunky in my opinion. Some things are a little more difficult to do now than they were a while back. I probably haven't provided you with much help, but just keep experimenting and I think you will figure it out.

Maybe you are looking for