Can`t close JDBC parameters.

Hello, I am trying to close a connection of resultset and statement to a class called ConnectionFactory. In this class is method for accepting a close parameter and executing a close for it. I keep geting these type of error:
com/watts/db/GarmentDAO.java [75:1] cannot resolve symbol
symbol : method ConnectionFactory (java.sql.ResultSet)
location: interface java.sql.Connection
con.ConnectionFactory(result);
^
com/watts/db/GarmentDAO.java [77:1] cannot resolve symbol
symbol : method ConnectionFactory (java.sql.Statement)
location: interface java.sql.Connection
con.ConnectionFactory(statement);
^
com/watts/db/GarmentDAO.java [109:1] cannot resolve symbol
symbol : variable statement
location: class com.watts.db.GarmentDAO
if(statement != null)
^
com/watts/db/GarmentDAO.java [110:1] cannot resolve symbol
symbol : variable statement
location: class com.watts.db.GarmentDAO
statement.close();
I have imported all the Classes but where is the trouble.
Here is my code
package com.watts.db;
import com.watts.entity.Customer;
import com.watts.entity.Garment;
import com.watts.connections.*;
import com.watts.business.ProductActivityException;
import com.watts.business.CreateException;
import com.watts.business.DuplicateKeyException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.NumberFormat;
import java.util.Collection;
import java.util.ArrayList;
import java.util.Vector;
public class GarmentDAO {
    private transient Garment garmVal = null;
    private Connection con;
    public GarmentDAO(Connection con) {
        this.con = con;
     public Object findByName(String name)
        throws DAOSysException, DAOFinderException {
          log("GarmentDAO: start findByName");
          if (itemExistsByName(name)) {
              return garmVal;
          throw new DAOFinderException ("Garment Not Found = "
                  + name);
    private boolean itemExistsByName(String garmName) throws DAOSysException {
        String queryStr ="SELECT * " +
                        "FROM Garment " +
                        "WHERE GarmentName = " + "'" + garmName.trim() + "'";
         return doExistQuery(queryStr);    
     private boolean doExistQuery (String qryString) throws DAOSysException {
        Statement statement = null;
        ResultSet result = null;
       boolean returnValue = false;
        try {
            log("GarmentDAO: before statement creation");
            statement = con.createStatement();
            log("GarmentDAO: statement created");
          log("GarmentDAO: query is" + qryString);
            result = statement.executeQuery(qryString);
            log("GarmentDAO: statement executed");
            if ( !result.next() ) {
                log("GarmentDAO: Garment not found");
                returnValue = false;
            else {
                log("GarmentDAO: Garment found");
              returnValue = true;
        } catch(SQLException se) {
               se.printStackTrace();
            throw new DAOSysException("Unable to Query for item " +
                                 "\n" + se);
        } finally {
            log("GarmentDAO: prior");
            con.ConnectionFactory(result);
            log("GarmentDAO: closeResult");
            con.ConnectionFactory(statement);
            log("GarmentDAO: closeStatement");
        return returnValue;
    }CONNECTION CLASS
package com.watts.connections;
import java.sql.*;
public class ConnectionFactory {
  private String _url;
    private String _username;
    private String _password;
    private String _dbDriverName;
    private Connection con;
  public ConnectionFactory(String connectURL, String uName,
     String pWord, String driverName){
         _url = connectURL;
         _username = uName;
         _password = pWord;
         _dbDriverName = driverName;
         _createConnections(_url,_username,_password,_dbDriverName);
private void _createConnections
     (String connectURL, String uName, String pWord, String driverName){
         try{
             Class.forName(driverName).newInstance();
               con = DriverManager.getConnection
                  (connectURL,uName,pWord);
         }catch(ClassNotFoundException ex){
             System.out.println(ex);
         }catch(InstantiationException ex){
             System.out.println(ex);
         }catch(IllegalAccessException ex){
             System.out.println(ex);
         }catch(SQLException ex){
             System.out.println(ex);
  public Connection getConnection(boolean autoCommit) throws SQLException {
        con.setAutoCommit(autoCommit);
        return con;       
  public static void close(ResultSet rs) {
    try {
      rs.close();
    } catch (Exception ignored) {}
  public static void close(Statement stmt) {
    try {
      stmt.close();
    } catch (Exception ignored) {}
  public static void close(Connection conn) {
    try {
      conn.close();
    } catch (Exception ignored) {}

For the same reason declaring method and class variables final helps clarify your code, adding transient to business-tier class variables can also be helpful. Anyone using reflection to serialize an arbitrary class can "depend" on the keyword having connotative meaning.
You don't need to give your variables sensible names, but it costs almost nothing, so why not do it?
- Saish
"My karma ran over your dogma." - Anon

Similar Messages

  • Crystal Reports's JRC. How to close JDBC connection?

    Hi!
    I have simple CR JRC application under Oracle AS 10.1.2.0.2, made from Crystal's sample codes.
    It works fine, but there is little problem: after closing vievwer's page JDBC connections stays alive.
    How can I close them?
    Here is my 2 jsp:
    ---------- Page1.jsp -----------------
    "<%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page import="com.crystaldecisions.reports.sdk.*" %>
    <%@page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
    <%@page import="com.crystaldecisions.report.web.viewer.*"%>
    <%
    // open the report rpt file
    String REPORT_NAME = "directs_q_d1.rpt";
    String Login =request.getParameter("p1");
    String Password =request.getParameter("p2");
    ReportClientDocument reportClientDoc = new ReportClientDocument();
    reportClientDoc.open(REPORT_NAME, 0);
    reportClientDoc.getDatabaseController().logon(Login,Password);
    ParameterFieldController paramFieldController = reportClientDoc.getDataDefController().getParameterFieldController();
    paramFieldController.setCurrentValue("", "reportname", new String("DIRECTS_QUARTERLY"));
    session.setAttribute("reportSource", reportClientDoc.getReportSource());
    reportClientDoc.close();
    response.sendRedirect("CrystalReportViewer.jsp");
    %>
    and
    ----------- CrystalReportViewer.jsp ------------------------
    <%//Crystal Report Viewer imports.%>
    <%@page import="com.crystaldecisions.report.web.viewer.*"%>
    <%@page import="com.crystaldecisions.reports.sdk.*" %>
    <%
    //Refer to the Viewers SDK in the Java Developer Documentation for more information on using the CrystalReportViewer
    //API.
    CrystalReportViewer viewer = new CrystalReportViewer();
    viewer.setOwnPage(true);
    viewer.setOwnForm(true);
    viewer.setPrintMode(CrPrintMode.ACTIVEX);
    viewer.setHasRefreshButton(false);
    viewer.setEnableDrillDown(false);
    viewer.setDisplayGroupTree(false);
    viewer.setHasToggleGroupTreeButton(false);
    viewer.setHasViewList(false);
    viewer.setHasLogo(false);
    //Get the report source object that this viewer will be displaying.
    Object reportSource = session.getAttribute("reportSource");
    viewer.setReportSource(reportSource);
    //Render the report.
    viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), out);
    viewer.dispose();
    %>
    -------------------------------------

    Oh, i'm sorry :) It was a "time-out" tag in CRconfig.xml. Tipic closed.

  • How can I close this application?

    I entered a script that autoclicks every 0.1 seconds and I didn't turn off the mouse thing so it just keeps entering 5s. I can't do anything except move my cursor(can't click or type). How can I close this application?

    > I have an interface (main vi) wich call another interface (pop
    > up).this interface call another interface. How can I do in order to
    > close the interface which is calling without stopping my application
    >
    There is a mechanism built into subVIs and subVI calls to open when
    called and close when finished. This still works fine for many tasks
    and is quick and easy. To use this, you can use the File>>VI Properties
    on your subVI, go to Window Appearance, Customize, and it is in the left
    column near the bottom.
    You can also set this on a subVI call by right clicking, choosing SubVI
    node setup and set the same Open when called and Close on exit settings.
    The difference between them is that the first will affect every usage of
    the VI, whereas the
    second can be set to pop open sometimes and other
    times not.
    Of course there is another way, introduced when the VI server was added.
    There is a VI property for the VI class, Front Panel Window Open.
    Setting it to True and FALSE will open and close. There is also now a
    method for opening and closing with a few additional options.
    The VI Server allows for more control and flexebility, but the first two
    options are still perfectly valid for simple things. If using them,
    closing your subVI is as simple as exiting your outer loop of your
    subVI. This returns and closes the window all at once giving control
    and and data parameters back to the caller. If using the VI Server, you
    can either close the window just before returning or leave it to the
    caller. Just be sure they are in agreement.
    Greg McKaskle

  • JDBC parameters in *.dbc file

    Hi,
    I have JDBC parameters as bellow , EBS version 12.1.3
    FND_JDBC_BUFFER_DECAY_INTERVAL=60
    FND_JDBC_BUFFER_MIN=5
    FND_JDBC_BUFFER_MAX=20
    FND_JDBC_STMT_CACHE_SIZE=100
    FND_JDBC_USABLE_CHECK=true
    FND_JDBC_PLSQL_RESET=false
    FND_JDBC_CONTEXT_CHECK=true
    FND_JDBC_BUFFER_DECAY_SIZE=50
    FND_MAX_JDBC_CONNECTIONS=100
    MY Assumption is as bellow
    When JVM starts.
    +Each JVM pool will open 5 connections in each pool.If all 5 are used it will open  5more connections as so on..
    +And Max connections per jvm at any give time is 100.
    + I am getting confused around FND_JDBC_BUFFER_MAX
    My Assumption is each pool have FND_MAX_JDBC_CONNECTIONS - FND_JDBC_BUFFER_MAX at any time,
    Can somone please provide more details on FND_JDBC_BUFFER_MAX .
    MOS doc does not provide accurate details.
    -Thanks
    Vijay

    What happens if all 20 Connections are actively used  as of now.. They will still terminated / cleaned ?
    If the connections are still being used then more available connections will be added to the pool (temporarily) until some of them get cleaned. If more JDBC connections need to be allocated and all the existing ones are still in use then you would start encountering out of processes/connections errors. That's why you need to tune your parameters (based on the number of JVMs, load, JDBC connections, ..etc) to avoid such errors.
    So it means that pool will start from FND_JDBC_BUFFER_MIn and once it reached FND_JDBC_BUFFER_MAX , buffer maintenance starts.
    If oool reached FND_JDBC_BUFFER_MAX, again FND_JDBC_BUFFER_MIN number of new connection will opens. but each pool will try maintain FND_JDBC_BUFFER_MAX of connections (20) under normal usage .
    Am i Correct ?
    Correct.
    Please keep in mind that each JVM has its own JDBC pool.
    Thanks,
    Hussein

  • How to close JDBC client connections in JSP (9IDS Jdeveloper)

    Can anyone tell me how to close JDBC connections neatly through JSP in Oracle 9IDS Jdeveloper.
    I have a developer who has deployed a WAR file (comprising JSP page) to the Tomcat webserver.
    The page works fine except that it always leaves a JDBC client connection after the user closes the internet explorer window.
    I've tried using dead connection detection without success.
    At the operating system level, I have a script that can kill these sessions but I would prefer if theres some way the connection can be closed neatly through the JSP application.

    Hi:
    At database level you can:
    See CONNECT_TIME and IDLE_TIME options to CREATE/ALTER PROFILE
    Joao

  • How can I close an AppleID/iCloud account that is no longer used?

    I have 2 MobileMe addresses that were moved to iCloud. As we all know, AppleID's cannot be merged. All of my purchases are under my main AppleID/ iCloud account. I just want to close the 2 I am not using. Has anyone ever successfully done this?

    You can't close accounts or ID's, you can only stop using them by deleting the accounts from your iOS devices.

  • Is there a way we can open/close posting periods on a "per day" basis?

    Hi SAP gurus,
    Is there a way we can open/close posting periods on a per day basis?
    It is not possible in OB52 since it only has control per period and not per day.
    Will assign points for suggestions. =) Thanks!

    Hii
    In standard SAP there is not such functionality where u can do these kind of configuration...it is at least for a month that is through OB52.
    If u still wants this functionality it is through the validation.
    u need to create the validation for that company code and thn u can use this functionality....
    hope it helps u
    reward points if helpful
    sejal singh

  • HT1414 I have in my ipad icloud backup window open and I can't close and I can't do anything I tried to press OK and nothing happen is freezing

    I have in my ipad icloud backup window open and I can't close and I can't do anything I tried to press OK and nothing happen is freezing

    Have you tried a soft-reset ? Press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider if it appears), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • How can I close one window without closing all open windows?

    If I open more than one window, I can't close just one. When I try to close just one, I'm warned that I'm about to close more than one (all of them) but I'm not told how to close just one.

    Are you sure you aren't getting tabs confused for windows? If you close a window containing multiple tabs, Firefox should give you a warning that you are about to close several tabs. To close a tab do one of the following:
    * click the x at the right end of the tab (when you only have a few tabs open)
    * open the tab you want to close, then click the x that appears
    * right click the tab and select 'Close Tab'
    * open the tab you want to close and press Ctrl+W
    You can close a window using Ctrl+Shift+W.

  • How can I close 'current' window and not all windows?

    How can I close the current window (only) and not all or none?
    This function works well with MS Explorer.
    Not a problem, just a desired function.

    Hi JLCluster,
    If you just click the small x in the tab you are currently viewing, it will close only that tab. I think you are clicking the x in upper right hand corner of the screen which closes all open tabs as you described.
    Hopefully this helps!

  • 2 websites are open simultaneously. How can I close one of the websites to have more space for the otheer websites

    Each time I use Firefox to open a news website A, another news website B appear on the left of A. How can I close A in order to have the full screen for B.

    Do a malware check with some malware scan programs. You need to scan with all programs because each program detects different malware. Make sure that you update each program to get the latest version of the database before doing a scan.
    * http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    * http://www.superantispyware.com/ - SuperAntispyware
    * http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    * http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    * http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked and Searches are redirected to another site

  • How can i install jdbc driver

    Hi
    i install websphere 5 and try to connect to my sql server but cannot find jdbc driver class path and can not find any jdbc driver
    pls tell me how can i install jdbc driver in my websphere
    with regards

    You may get a better response posting this question in a WebSphere specific forum. Maybe this will help, the following link shows the command you need to execute to install a JDBC driver in websphere 5.0.
    http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?tab=search&searchWord=mysql+driver&maxHits=50

  • How can I close out the page I am working on in safari when error boxes keep popping up?

    How can I close out the page I am working on in safari when error boxes keep popping up?

    What do the error messages say ?

  • HT204053 It seems as if I have 2 accounts.  I would like to combine one account with the other.  How can I close one apple ID and combine it with the other that I was not aware I had set up???

    I would like to close one account and only use the other.  D

    You can't close or delete accounts (you can only remove any personal info from them and stop using them), and you can't merge accounts or transfer purchases to another account - content will remain tied to the account that downloaded them.

  • How do I remove iMessage "sign in" box from my IPad "messages" screen. I don't want to create a new Apple ID but I can't close this box.

    When selecting the "Messages" sceen on my IPad, the iMessage "Sign in" box appears on the screen. I don't want to create a new Apple ID but I can't close this box which is preventing me using the normal text message screen. How do I get rid of this sign-in box?

    Yeah i have that same type of problem, sorta.
    I made my apple id today on my ipad 2 ios 6 update and i went straight to logging in on iMessage, i logged in, after reading i clicked next, i got the email to verify on my ipod so i verified but as it was still verifying on the ipad it went right back to the log in box. this repeated itself over and over, help?

Maybe you are looking for

  • DistinguishedName mapping in AD schema

    Hi, I want to know if below settings are appropriate: AD schema has one of this entry: userDN <--> distinguishedName Identity template : $userDN$ and Create workflow has code like: <set name='view.accounts[AD].userDN'><s>cn=xxx,ou=abc,dc=test,dc=com<

  • How do I suppress zeroes from being displayed in numbers?

    Hello, I am generating a calculated dollar amount in one column that is based on values in another column. If I apply the formula to the entire column, most of the values are zero dollar in standard currency format because most of the rows have yet t

  • Email issues with PC users

    I am a web project manager and email daily with both PC & Apple users. I use Apple Mail as my default program. I have had countless issues with the formatting of my email appearing differently to PC users on Outlook when sending or forwarding Rich Te

  • What is the maximum number of photos in a iphoto book?

    What is the maximum number of photos in an iphoto book?

  • Can't mount DVD

    I have a semi-professional DVD that won't mount on my MBP running 10.7.3 nor on one running 10.6.8. It did mount on a Macbook running 10.5.8 and launched iDVD and played the movie. On a fourth MacBook running 10.5.8 it mounted but wouldn't play until