Connections and statements

OK, I'm finally arriving to my solution.
Now I have some conceptual doubts.
I am instantiating a Connection object using
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection(CONNECTIONSTRING, USERNAME, PASSWORD);I'm using this Connection object to instantiate some other objects (passing it as an argument to the constructor). Then, each one of this new object will create a Statement object (con.createStatement()) to execute periodic queries. Each object executes different queries to the database.
My doubts are:
1 - Does this way of accessing to the database (sharing a single Connection object) present some difference with respect to creating a new connection for each Statement ?
2 - If close the Connection con (con.close()), will all the Statement objects die ?
Thanks!!

1. Sharing a Connection object to create different
statements is desirable as it saves resources in terms
of number simulataneous connections to the database.
This reduces the stress on the DBMS. I also would
recommend looking into a connection pooling.Excellent, this is what I espected. By the way, I don't know what a connection pooling is. Could you please explain the concept ?
One more thing. All the objects sharing the connection will query the database periodically (every few seconds) as long as they are alive, and they will do this asynchronously. I mean, one object doesn't know when the other objects will query the database. Furthermore, not all of them have the same query period.
How will this fact affect the DBMS ?
Thanks

Similar Messages

  • TS2972 itunes will not allow me to download a homeshare library - has connected and states it is downloading but then doesn't show the library?

    Have connected to homeshare, but Itunes will not let me see the homeshare library from another PC.  It is connected and when I click on ******homeshare library it says it is downloading it - but then doesn't????  Help!

    Hello ariani,
    Thank you for the details of the issue you are experiencing with Home Sharing in iTunes.  I recommend the following steps for the issue you described:
    4. Check your network connection
    Home Sharing requires a home network with an active Internet connection. All the devices you want to use with Home Sharing need to be connected to your home network.
    In addition, verify that:
    All your devices are connected to the same router, if you have multiple routers. Using multiple routers may prevent discovery between these devices.
    Your devices are not using a Virtual Private Network (VPN), or that they are all on the same VPN. A VPN may isolate the device and cause connectivity disruptions.
    If you have a router set up with a guest network, make sure all devices are either connected to the guest network and devices on the guest network are allowed to communicate with each other, or switch all devices to the primary network on your router.
    If your computer is asleep or shutdown, or iTunes is closed, there's no access to the shared iTunes library. Wake up or start the computer and open iTunes to regain access to that library.
    Your router needs to be up-to-date. If you are using an AirPort or Time Capsule, read this article to find out more about firmware updates. If you are using a router from another manufacturer, contact the manufacturer to inquire about available updates.
    5. Check Firewall Settings
    If you have a firewall enabled in your router or computer, make sure that the firewall is not blocking communication between your computers. Home Sharing uses TCP port 3689 and UDP port 5353 to communicate with shared iTunes libraries.In addition, Apple TV and Mac computers will use port 123 to set the time automatically. Incorrect date and time on either the computer or Apple TV can cause errors for Home Sharing and connections in general.If you are unsure whether your router has a firewall or the required ports open, test additional devices or another network to help isolate the issue. If the devices tested work on another home network, it is your router or network configuration.For Mac OS X, you don't have to edit the port addresses, but make sure the firewall in Apple () menu >System Preferences > Security > Firewall are not set to:
    Block all incoming connections
    Allow only essential services
    If you use another security/firewall software on your computer or router, follow this article or contact the manufacturer or check the documentation on how to open TCP ports 123 and 3689 as well as UDP ports 123 and 5353.
    6. Quit and reopen apps and iTunes
    If connectivity issues persist, quit and reopen iTunes on your computer. Then, quit and reopen the apps on your iOS device.
    7. Restart your network router
    Restart your home network router using the method recommended in documentation from the manufacturer. This may include disconnecting the power cord for thirty seconds or more.
    Note: During this period, Internet services such as a VoIP-based phone will not work, and any additional routers may need to be reset in sequence.
    Troubleshooting Home Sharing
    http://support.apple.com/kb/TS2972
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Why to need close the result set and statement

    why to need close the result set and statement

    It's best to explicitly close every ResultSet, Statement, and Connection in the narrowest scope possible.
    These should be closed in a finally block.
    Since each close() method throws SQLException, each one should be in an individual try/catch block to ensure that a failure to close one won't ruin the chances for all the others.
    You can capture this in one nice utility class, like this:
    package db;
    import java.sql.*;
    import java.util.ArrayList;
    import java.util.Map;
    import java.util.LinkedHashMap;
    import java.util.List;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    * Created by IntelliJ IDEA.
    * User: MD87020
    * Date: Feb 16, 2005
    * Time: 8:42:19 PM
    * To change this template use File | Settings | File Templates.
    public class DatabaseUtils
         * Logger for DatabaseUtils
        private static final Log logger = LogFactory.getLog(DatabaseUtils.class);
        /** Private default ctor to prevent subclassing and instantiation */
        private DatabaseUtils() {}
         * Close a connection
         * @param connection to close
        public static void close(Connection connection)
            try
                if ((connection != null) && !connection.isClosed())
                    connection.close();
            catch (SQLException e)
                logger.error("Could not close connection", e);
         * Close a statement
         * @param statement to close
        public static void close(Statement statement)
            try
                if (statement != null)
                    statement.close();
            catch (SQLException e)
                logger.error("Could not close statement", e);
         * Close a result set
         * @param rs to close
        public static void close(ResultSet rs)
            try
                if (rs != null)
                    rs.close();
            catch (SQLException e)
                logger.error("Could not close result set", e);
         * Close both a connection and statement
         * @param connection to close
         * @param statement to close
        public static void close(Connection connection, Statement statement)
            close(statement);
            close(connection);
         * Close a connection, statement, and result set
         * @param connection to close
         * @param statement to close
         * @param rs to close
        public static void close(Connection connection,
                                 Statement statement,
                                 ResultSet rs)
            close(rs);
            close(statement);
            close(connection);
         * Helper method that maps a ResultSet into a map of columns
         * @param rs ResultSet
         * @return map of lists, one per column, with column name as the key
         * @throws SQLException if the connection fails
        public static final Map toMap(ResultSet rs) throws SQLException
            List wantedColumnNames = getColumnNames(rs);
            return toMap(rs, wantedColumnNames);
         * Helper method that maps a ResultSet into a map of column lists
         * @param rs ResultSet
         * @param wantedColumnNames of columns names to include in the result map
         * @return map of lists, one per column, with column name as the key
         * @throws SQLException if the connection fails
        public static final Map toMap(ResultSet rs, List wantedColumnNames)
            throws SQLException
            // Set up the map of columns
            int numWantedColumns    = wantedColumnNames.size();
            Map columns             = new LinkedHashMap(numWantedColumns);
            for (int i = 0; i < numWantedColumns; ++i)
                List columnValues   = new ArrayList();
                columns.put(wantedColumnNames.get(i), columnValues);
            while (rs.next())
                for (int i = 0; i < numWantedColumns; ++i)
                    String columnName   = (String)wantedColumnNames.get(i);
                    Object value        = rs.getObject(columnName);
                    List columnValues   = (List)columns.get(columnName);
                    columnValues.add(value);
                    columns.put(columnName, columnValues);
            return columns;
         * Helper method that converts a ResultSet into a list of maps, one per row
         * @param rs ResultSet
         * @return list of maps, one per row, with column name as the key
         * @throws SQLException if the connection fails
        public static final List toList(ResultSet rs) throws SQLException
            List wantedColumnNames  = getColumnNames(rs);
            return toList(rs, wantedColumnNames);
         * Helper method that maps a ResultSet into a list of maps, one per row
         * @param rs ResultSet
         * @param wantedColumnNames of columns names to include in the result map
         * @return list of maps, one per column row, with column names as keys
         * @throws SQLException if the connection fails
        public static final List toList(ResultSet rs, List wantedColumnNames)
            throws SQLException
            List rows = new ArrayList();
            int numWantedColumns = wantedColumnNames.size();
            while (rs.next())
                Map row = new LinkedHashMap();
                for (int i = 0; i < numWantedColumns; ++i)
                    String columnName   = (String)wantedColumnNames.get(i);
                    Object value = rs.getObject(columnName);
                    row.put(columnName, value);
                rows.add(row);
            return rows;
          * Return all column names as a list of strings
          * @param rs query result set
          * @return list of column name strings
          * @throws SQLException if the query fails
        public static final List getColumnNames(ResultSet rs) throws SQLException
            ResultSetMetaData meta  = rs.getMetaData();
            int numColumns = meta.getColumnCount();
            List columnNames = new ArrayList(numColumns);
            for (int i = 1; i <= numColumns; ++i)
                columnNames.add(meta.getColumnName(i));
            return columnNames;
    }Anybody who lets the GC or timeouts or sheer luck handle their resource recovery for them is a hack and gets what they deserve.
    Do a search on problems with Oracle cursors being exhausted and learn what the root cause is. That should convince you.
    scsi-boy is 100% correct.
    %

  • I am connected to a time capsule both wirelessly and through ethernet...and state of the time capsule is solid green...the internet however doesn't work...The internet works fine when directly connected to my macbook pro but it won't work through the tc

    I have deleted time machine preferences...restarted the modem a bunch of times, restored time capsule to it's original settings...after I first set it up in Airport Ulitity its shows a page quickly that states there is a internet problem, but the page quickly goes away before I can read what it says exaclty and states the internet connection problem is resolved...
    However it's not resolved, I'm also having trouble doing a back up to my time capsule...I recently purchased a new macbook and retrieved/restore what was on the time capsule to the new computer...that worked fine...wireless worked fine...however when I tried to back up the new macbook...it would faii stating that there isn't enough room on the TC to do a back up...
    I didn't end up keeping the new macbook, I was just using it/trying it out while my current macbook pro was being repaired (logic board)
    Ever since I got my current macbook back from repair...my backups have failed due to their not being enough space to perform the back up...in the past the back ups would happen and old back ups would be replaced...
    I think this has to do with my current computer having a new name after the repair..."Adam's macbook pro 2" vs "Adam's macbook pro"
    The internet was working fine wirelessly through the TC a day ago, but it wasn't allowing my other laptop that was connected via ethernet access to the internet...I had a self assigned IP address error then...I don't have that problem now, but it's not transmitting internet at all...even though it's in a solid green state.
    I have no problem completely wiping out my TC including the previous back ups on it...just don't know how to go about it...I have restored it to factory settings a bunch of times and created the network from scratch...just hasn't fixed the issue
    Is there more prefences files I should delete

    If the modem is also a router, either use the modem in bridge and run pppoe client on the TC.. that is assuming ADSL or similar eg vdsl. If it is cable service.. and the modem is a router, then bridge the TC.. go to internet page and select connect by ethernet and below that set connection sharing to bridge.
    Please tell us more about the modem if the above gives you issues.

  • I have a set of 3 USB disk connected to my TC via a USB hud. I usually swithc the TC at night. When I restart the next day it stucks in amber state. when I disconnect the USB hub where my discs connects and restart, it start properly. Any hints?

    I have a set of 3 USB disks connected to my Time capsule (TC) via a USB hub. I usually switch the TC at night. When I restart the next day it stucks in amber state. When I disconnect the USB hub where my discs connects and restart, the TC will start properly. Any hints?

    LOL.. don't switch off the TC.. this is fairly typical behaviour..
    Or try a different usb hub.. but you could well and truly run out of hubs before you fix the problem.
    Are you running latest firmware for your TC?
    What error message is coming up in the airport utility.. amber led is a fault indicator.. look up what the actual fault is and see if it is for instance overloading the usb. You are using a powered hub??
    Get one bigger USB hard disk instead of 3 smaller ones.

  • CONNECT and ALTER statements in a Procedure. COPY command in SQL*Plus

    Hi people,
    Is it possible to use the SQL commands, "CONNECT" and "ALTER TABLE" in a procedure, function or trigger?
    In one of my audit procedures, I need to connect to a financial database (FROM the applications database), and then proceed to alter a number of tables based on certain data. I'm sure I've done it before, but I can't remember how! Isn't there a command such as "EXEC_SQL" or something?
    Another question:
    I need to copy a table from one database ("OPS$TSLIVE") to another ("TRACKER"). Here is an excerpt of my code, as well as an error! I've never had this error before!
    JOHANN> copy from ops$tslive/pwd@cds to tracker/pwd@tracker create new_alerts using select * from alertcodesfile;
    Array fetch/bind size is 15. (arraysize is 15)
    Will commit when done. (copycommit is 0)
    Maximum long size is 80. (long is 80)
    select * from alertcodesfile
    Error in SELECT statement: ORA--1002: Message -1002 not found; product=RDBMS; facility=ORA
    Please help!
    Kind regards,
    Johann.

    You are refering to 'execute immediate' (>=8i). As far as I know it is not possible to do connects. Alter table perhaps, if it is in the local database (try it). If you want to perform dml in a remote database, create a database link and use that to perform you dml on. a DB link can also be used to call a remote procedure (That perhaps does the alters for you). Try it.
    The oracle doc says this about ORA-1002:
    ORA-01002 fetch out of sequence
    Cause: In a host language program, a FETCH call was issued out of sequence.
    A successful parse-and-execute call must be issued before a fetch. This can
    occur if an attempt was made to FETCH from an active set after all records have
    been fetched. This may be caused by fetching from a SELECT FOR UPDATE
    cursor after a commit. A PL/SQL cursor loop implicitly does fetches and may
    also cause this error.
    Action: Parse and execute a SQL statement before attempting to fetch the data.It looks like a bug, ask Oracle support.
    L.

  • My Daughter forgot passcode an ipod disabled. I started the restoration and in the middle itunes disconnects and states cannot connect to ipod because locked, put in passcode.

    My Daughter forgot her passcode and disabled her ipod touch.  When I do the restore settings on itunes. It starts out fine and then in the middle it disconnects the ipod and states that itunes can not connect due to passcode locked, enter passcode.  Any help would be appreciated.?

    iOS: Unable to update or restore

  • HT4157 I am trying to use my cellular data on iPad and states connection failed. What do I need to do?

    I am trying to use cellular data and states connection failed. What do I need to do to fix this?
    Thanks

    Hi there April3939,
    You may find the troubleshooting steps in the article below helpful.
    iPad (Wi-Fi + Cellular Models): Troubleshooting a cellular data connection
    http://support.apple.com/kb/TS4249
    -Griff W. 

  • My Time capsule/time machine stopped backing up and states no disk found-now I can't even get connected to time capsule

    My Time capsule/time machine stopped backing up and states no disk found-now I can't even get connected to time capsule.  When I go into sys pref and time machine nothing comes up and it just keeps stating rescan

    Go to to your Users/Home/Library/Application Support/iWeb folder in the Finder and then enter  Time Machine.  Go back to the last backup that has the domain file, select it and use the Restore button.
    OT

  • My time capsule works with my laptop but not my iphones and states it has no internet connection even though it is working on my laptop.

    I purchased a time capsule when I upgraded my iphone to the iphone 5 in November of 12.  The time capsule was very easy to set up and both phones and the laptop worked great. In March of this year, the iphones would no longer connect to the time capsule network.  When I would run the airport utility, I would see errors for no internet connection and no DNS servers.  The funny thing is that my laptop would wirelessly connect to the internet through the time capsule. I am currently on my laptop now but my phones don't work.  I am thinking that I updated software for both my phone and the time capsule so I tried reverting the software on the time capsule but it still gave me the same errors. If I hook the cable modem to my pc, it works, so I don't have an internet service provider issue. The issue seems to be with the airport device/time capsule. I have reset things to the factory default and didn't bother setting any password for the network but to no avail... If anyone knows what I can do to fix this, please assist... I am ready to give up on fixing it and revert back to my old wireless device. Thanks

    Set it up with SMB compliant names.. that means, short, no spaces and pure alphanumeric.
    Set a different name for 2.4ghz and 5ghz..
    Set security to WPA2 personal with pure alphanumeric password.. 10-20 characters is usually plenty.
    Set wireless channel for 2.4ghz to manual and try channels 11, 6, 1 in that order.

  • Can Not Sign In to FaceTime - states check network connection and try again - but network is fine.

    I repeatedly keep getting notified: Could Not Sign In. Please check network connection and try again. When trying to log into FaceTime. Also note that click FaceTime on bar that Preferences is not highlighted by light gray. I can log into my apple ID okay and log in to write this comment without any problem. I am trying to talk with my Grandkids in England from Arizona on the iPads that I sent to each of them from my iMac. What am I doing wrong - have been repeatedly trying for past three hours.
    Grandpa is needed!

    Hi RVBob,
    Sometimes firewalls cause trouble with Facetime, iMessage and other Apple apps - please try to open these ports from your router firewall (or ask somebody to do it if you don't know how).
    Enable port forwarding on the following ports to use FaceTime and iMessage on a restricted network.
    Ports
    FaceTime
    iMessage
    80 (TCP)


    443 (TCP)


    3478 through 3497 (UDP)

    5223 (TCP)


    16384 through 16387 (UDP)

    16393 through 16402 (UDP)

  • TS5223 iMessage Activation states could not sign in. Please check your network connection and try again.  Why do I get this question?  I am not getting many texts!

    On IOS7, iMessage "waiting for activation" when I enter my Apple ID for iMessage, I receive a message "Could not sign in.  Please check your network connection and try again"  I am unable to get many text message because of this.  What do I do?

    If you're having trouble logging in to FaceTime or Messages, the following article may be useful:
    iOS: Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/ts4268

  • Implicit vs explicit close of resultsets and statements?

    Hi friends.I am a newbie Java Developer..Okay Here goes
    I have just made a LAN based Java application using Swing,JDBC with backend as MS-Access..The backend is on a shared network drive..
    The application is distributed as jar files on the LAN PCs..
    Everywhere I have connected to the database I have just closed the connection explicitly like this
    con.close();
    I do not close the associated resultset and statement explicitly
    The specification says associated statements and resultsets close when you close
    the connection,even if you don't explicitly close them
    Also I am not using connection pool..its simple basic connection using DriverManager
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String url = "jdbcdbcSN name";
    String user = "";
    String pw = "";
    con = DriverManager.getConnection(url, user, pw);
    Statement stmt = con.createStatement();
    String select = "" ;
    ResultSet rows = stmt.executeQuery(select);
    On the net everyone says to explicitly close everything..but I did not know that
    earlier..
    If specification says everything closes on
    closing connection why do ppl insist on closing everything explicitly..?
    Or is this driver dependent..don't the drivers go through the specification..
    My driver is the Sun JDBC ODBC bridge.....
    I found this method DriverManager.setLogwriter()
    It prints out a trace of all JDBC operations..
    So I ran a sample program with this method included...
    I redirected output to a log file..
    In that program I just explicitly close the connection without closing the
    statements and resultsets explicitly...
    After running the program and seeing the log I saw that the statements
    and resultsets are closed implicitly If I just close the connection explicitly..
    I am putting the log file and the code..
    Have a look at the end of the log file..
    Code
    import java.sql.;
    import java.io.;
    class gc4test
    public static void main(String args[])
    Connection con = null;
    try
    FileWriter fwTrace = new FileWriter("c:\\log.txt");
    PrintWriter pwTrace= new PrintWriter(fwTrace);
    DriverManager.setLogWriter(pwTrace);
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String url = "jdbc:odbc:pravahcon";
    String user = "admin";
    String pw = "ash123";
    con = DriverManager.getConnection(url, user, pw);
    Statement stmt = con.createStatement();
    Statement stmt1 = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
    Statement stmt2 = con.createStatement();
    Statement stmt3 = con.createStatement();
    Statement stmt4 = con.createStatement();
    Statement stmt5 = con.createStatement();
    Statement stmt6 = con.createStatement();
    Statement stmt7 = con.createStatement();
    String select = "SELECT * FROM Users" ;
    ResultSet rows = stmt.executeQuery(select);
    ResultSet rows1 = stmt1.executeQuery(select);
    while(rows.next())
    con.close();
    catch (ClassNotFoundException f)
    System.out.println(f.getMessage());
    System.exit(0);
    catch (SQLException g)
    System.out.println(g.getMessage());
    System.exit(0);
    catch (Exception e)
    System.out.println(e.getMessage());
    System.exit(0);
    End of Log File
    Setting statement option (SQLSetStmtAttr), hStmt=50275112, fOption=25
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    End of result set (SQL_NO_DATA)
    *Connection.close
    8 Statement(s) to close
    *Statement.close
    Free statement (SQLFreeStmt), hStmt=50281544, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@2e7263
    *Statement.close
    Free statement (SQLFreeStmt), hStmt=50277224, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@1bf216a
    *Statement.close
    *ResultSet.close
    *ResultSet has been closed
    Free statement (SQLFreeStmt), hStmt=50274224, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@156ee8e
    *Statement.close
    Free statement (SQLFreeStmt), hStmt=50280464, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@c20e24
    *Statement.close
    Free statement (SQLFreeStmt), hStmt=50278304, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@12ac982
    *Statement.close
    *ResultSet.close
    *ResultSet has been closed
    Free statement (SQLFreeStmt), hStmt=50275112, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@e0e1c6
    *Statement.close
    Free statement (SQLFreeStmt), hStmt=50276144, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@6ca1c
    *Statement.close
    Free statement (SQLFreeStmt), hStmt=50279384, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@1389e4
    Disconnecting (SQLDisconnect), hDbc=50271048
    Closing connection (SQLFreeConnect), hDbc=50271048
    Closing environment (SQLFreeEnv), hEnv=50270880
    So like what these implicitly closed statements and resultsets are different from explicitly closed
    resultsets and statements..?

    Please do not crosspost/doublepost the same question again. It is rude in terms of netiquette.
    Stick to one topic: [http://forums.sun.com/thread.jspa?threadID=5393387&messageID=10745794#10745794].

  • Java Bean Connectivity and Closing Connections (XI 3.0)

    Hi guys,
    We have existing Java Beans that we would like to use with Crystal Reports. Our current Java beans return a disconnected GridModel and explicitly close the connection immediately after so that they can be returned to the connection pool (Oracle).
    Once we modified these beans to return ResultSets we found that closing the connection also closes all the associated ResultSets and Statements.
    What is the best practice here?
    Modify the Java bean to close the connection in the finally block?
    Will Crystal clean up after itself?
    I also see there is something called a CachedRowSet which is disconnected:
    http://java.sun.com/j2se/1.5.0/docs/api/javax/sql/rowset/CachedRowSet.html
    Is this supported by Crystal?
    Thanks,
    Kevin D Lee =)

    Hello Kevin,
    Enterprise XI 3.0 CRConfig.xml points to Java JRE 1.5 provided with the install, so you should be ok with the CachedRowSet. 
    It's used by other customers for disconnected operation.
    Since you're going to Oracle, you'd likely encounter issues mapping Oracle fields to POJO property types.
    Furthermore, POJO Factory libraries that were shipped with Crystal Reports XI Release 2 aren't shipped with Enterprise XI 3.0, so you'd not find that an out-of-the-box option. 
    Another alternative to CachedRowSet is to define callback method in your JavaBeans class that Crystal will call when it's done with the data source. 
    This has been implemented in XI 3.0 (track ADAPT00877915) - excerpt from the track note:
    <JavaBeans>
        <CacheRowSetSize>100</CacheRowSetSize>
         <JavaBeansClassPath>c:\javabeans\</JavaBeansClassPath>
         <CallBackFunction>CrystalReportsLogoff</CallBackFunction>
    </JavaBeans>
          Customer can configuration the <CallBackFunction/> to let CR know
          which function should be invoked when loging off.
    Advantage of CachedRowSet is that you can immediately close it after you've read all the data, disadvantage would be the default implementation stores all data in memory.
    Advantage of the callback method is that it would use the JavaBean you've supplied (and not load all data immediately in memory), but callback won't be called immediately, but only after the report is done with.
    Sincerely,
    Ted Ueda

  • Closing resultset and statements

    Hi!
    I just got told that I do not need to close my resultsets and statements in the code, it it enough that the connection are closed. Is this correct?
    Eg:
    public method myMethod() {
    ResultSet rs = null;
    Statement sqlStmt = null;
    try {
    query = "SELECT something";
    rs = sqlStmt.executeQuery(query);
    if (rs.next())
    do something...
    // close rs
    if (rs != null) {
    rs.close();
    rs = null;
    sqlStmt.close();
    sqlStmt = null;
    } // end try
    catch (errors)...
    finally {
    if (con != null) {                   <-- Is this line enough to close everything and release connections?
    try {
    con.close();
    catch (exception)...
    } // end finally

    No, you have to explicitly close the resultset, statement, and connection in order to release resources allocated to each of them. Closing the connection will only relase the connection, not the resultset, and statement.
    you could do all of it in the finally as follows:
    finally {
         try {
              if (rs != null) {
                   rs.close();
              if (stmt != null) {
                   stmt.close();
              if (conn != null) {
                   conn.close();
         } catch (Exception e) {}
    also there is no need to set rs = null, stmt = null after the close()

Maybe you are looking for

  • When I 'm in the process of surfing or researching the pages seem to start roaming and change format visually; by font size or screen size, sometimes by page;

    "I'm {oleave nline) or attempting to sign on, the screen shows a symbol of sorts and the screen changes in size or shape. Not like a magnifying glass, but similar; other times when I'm viewing a page, it's as thought someone is controlling the moveme

  • Customer master Screen

    Hi, I am having one time customer Account in screen change I keep reconcillation account as an OPTIONAL entry but systems taking it as mandatory entry Why this is happenning ?  How to make that field as as Optional entry. for other fields it is runni

  • Cartridge instances

    I'm running a servlet in OAS (latest version) and it takes a very long time to process. I set the logging to 15 and got the following log information. The cartridge seems to take 45 seconds to startup a new thread/instance. The same issue appears on

  • Doesn't Start, blinking folder

    So I started my macbook up, and i got a grey screen. After trying several things (PRAMVRAM reseet, SMC reset) I took out the drive and placed it in an enclosure (USB) and it boots off of that fine. but then it doesn't when i put it back into the HDD

  • CS5 - "Not Responding" message when saving large files??

    For quite some time now, I have been getting a message in the Save Progress Bar Dialogue that says "Not Responding" .... after I start saving a file.  The progress bar will advance about 20%, then it will say (Not Responding) in the box.... and then