Doubt in pass of connection by parameter

I have a technical doubt about pass of parameters. I have a method to which I pass as parameter a connection with database like 'public void ejecutarSelect (Connection with, String selec)'. The connection comes opened to the method, and it only executes the select. The connection is closed out of the method.
Here my doubt comes. In java all parameter passed to a method is for value, I mean, to the beginning of the method is created a copy of the variables passed by parameter and at the end of the method it destroys them. But in case of the connection, does the method copy the pointer to the connection or really it clon the connection with database? I am interested becuase I want to know if I would be leaving connections open.
Thanks.

Java passes all parameters by value. Parameters hold primitive types and Object references (not Objects). In your case the Object reference is being passed by value but that in effect causes the Object (Connection in your case) to be passed by reference.

Similar Messages

  • How to pass more than one parameter using common...

    Hi,
    I am using ODP.NET with my 2005 VB
    I want to create function from where I can pass more than one parameter to execute SP, or query just like i created for SQL SERVER as below
    Public shared Function CreateParameter(ByVal paramname As String, ByVal paramvalue As Object) As DbParameter
    Dim param As DbParameter
    param = New SqlParameter
    param.ParameterName = paramname
    param.Value = paramvalue
    Return param
    End Function
    Public Shared Function ExecuteQuery(ByVal sql As String, ByVal commtype As CommandType, ByVal ParamArray parameter As DbParameter())
    Dim cmd As DbCommand = New SqlCommand()
    cmd.Connection = OpenConnection()
    cmd.CommandType = commtype
    cmd.CommandText = sql
    cmd.Parameters.AddRange(parameter)
    Dim RetVal As Integer = cmd.ExecuteNonQuery()
    Return RetVal
    End Function
    specially part is in bold to be converted
    I tried like but oracleCommand.parameters doesnt support AddRange
    please help me out
    Regards

    Hello,
    I used the following way:
    pCommand.CommandText = "Update " + sDataTable + " set "
    + sColumnName + " = :1 ";
    pCommand.Parameters.Add("ValueToDb",
    this.DefaultDbType,
    this.m_Value,
    System.Data.ParameterDirection.Input);
    Of course, you can add :2,... to your command text, too.
    The way back is:
    sEndOfTheClause += " RETURNING " + sDataTable + "." + sColName + " INTO :iNewValue";
    pCommand.CommandText = ... + sEndOfTheClause;
    pCommand.Parameters.Add("iNewValue", this.DefaultDbType,
    ParameterDirection.Output);
    bool bReturn = (pCommand.ExecuteNonQuery() != 0);
    if ((bReturn == true) && (pCommand.Parameters.Count > 0))
    this.Value = DataService.Convert<DATA_TYPE>(pCommand.Parameters[0].Value);
    ....

  • How to pass more than one parameter

    Hello,
    This is my code.
    How to pass more than one parameter:
    SELECT:responsibility_name responsibility_name,
    LPAD(' ', 6*(LEVEL-1))
      || menu_entry.entry_sequence sequence ,
      LPAD(' ', 6*(LEVEL-1))
      || menu.user_menu_name SubMenu_Description ,
      LPAD(' ', 6*(LEVEL-1))
      || func.user_function_name Function_Description ,
      LPAD(' ', 6*(LEVEL-1))
      || menu_entry.prompt prompt
      ,menu.menu_id ,
      func.function_id
      --menu_entry.grant_flag Grant_Flag ,
      --DECODE( menu_entry.sub_menu_id , NULL, 'FUNCTION' , DECODE( menu_entry.function_id , NULL, 'SUBMENU' , 'BOTH') ) Type
    FROM fnd_menu_entries_vl menu_entry ,
      fnd_menus_tl menu ,
      fnd_form_functions_tl func
    WHERE menu_entry.sub_menu_id    = menu.menu_id(+)
    AND menu_entry.function_id      = func.function_id(+)
    AND MENU.LANGUAGE(+) = 'US'
    AND FUNC.LANGUAGE(+) = 'US'
    --AND func.user_function_name LIKE '%Primary Care Providers%'
    AND grant_flag                  = 'Y'
      START WITH menu_entry.menu_id =
      (SELECT menu2.menu_id
      FROM fnd_menus_tl menu2,apps.fnd_responsibility_vl resp
      WHERE menu2.menu_id=resp.menu_id
      and resp.responsibility_name= :responsibility_name
      --and menu2.user_menu_name = ('ATCO HR INQ USER'
      AND LANGUAGE = 'US'
      CONNECT BY MENU_ENTRY.MENU_ID = PRIOR MENU_ENTRY.SUB_MENU_ID
       and menu_entry.function_id not in (select func.function_id
                                       from --fnd_form_functions_vl fnc,
                                       apps.fnd_resp_functions exc,
                                       apps.fnd_responsibility_vl res
                                      where func.function_id = exc.action_id
                                      and res.responsibility_name =:responsibility_name
                                      and res.responsibility_id=exc.responsibility_id)
      and menu_entry.sub_menu_id  not in (select menu.menu_id
                                       from --fnd_menus_vl imn,
                                       apps.fnd_resp_functions exc,
                                       apps.fnd_responsibility_vl res
                                       where menu.menu_id = exc.action_id
                                       and res.responsibility_name =:responsibility_name
                                      and res.responsibility_id=exc.responsibility_id)
    ORDER SIBLINGS BY menu_entry.entry_sequence;
    Thank you for your help
    Shuishenming

    Hi, Ming,
    One way is to put the "parameters" in a table, and join to that table in your query.  If you make it a Global Temporary Table, then multiple sessions can run the query at the same time, and each can be seeing different responsibilities.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.  Since this problem involves parameters, you should give a couple of different sets of parameters, and the results you want from the same sample data for each set.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Pass table name as parameter in prepared Statement

    Can I pass table name as parameter in prepared Statement
    for example
    select * from ? where name =?
    when i use setString method for passing parameters this method append single colon before and after of this parameter but table name should be send with out colon as SQL Spec.
    I have another way to make sql query in programing but i have a case where i have limitation of that thing so please tell me is it possible with prepared Statment SetXXx methods or not ?
    Thanks
    Haroon Idrees.

    haroonob wrote:
    I know ? is use for data only my question is this way to pass table name as parameterI assume you mean "how can I do it?" As I have already answered "is this the way?" with no.
    Well, I would say (ugly as it is) String concatenation, or stored procedures.

  • How to Pass a multi-select parameter in BI to a PL/SQL Program

    I am trying to pass a BI report parameter which is multi-select enabled in BI Enterprise Stand-Alone reporting tool. eg. it comes out in the data model like this: <P_CLASS_CODE>[DISABLED_VETERAN_OWNED, HUB_ZONE, LARGE_BUSINESS]</P_CLASS_CODE>
    to a pl/sql stored procedure. (this is some kind of record set)
    This works when passing the parameter as bind variable being passed to and IN CLAUSE. However, In my case I need a little bit more flexibilty with the programming so I need to get the value into PL/SQL so I can work with the individual values in the record set.
    I am trying to figure out which collection type or record type I can use in pl/sql to be able to parse out the elements in the collection from within a stored procedure so I can loop through the elements.
    I am trying to call the BI before report trigger in the data template like this:
    <dataTrigger name="beforeReportTrigger" source="XXAPRPT03_SUPPLIER_DIVERSITY.before_report_trigger(:p_class_code)"/>
    this call refers to the default package
    I get this error: 'Invalid column type'
    what type should I be using in my procedure definition to support the multi-selection record set which my parameter is passing from BI.

    Hi,
    Okie :) please feel free to post any problem :)
    Please apply the patch that has the fix for this issue:
    [Patch 9791839|https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=9791839]
    The above link worked fine for me .
    Ideally, you should pick up the latest patch, which is [ Patch 11846804|https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=11846804]
    Click on View Read me for install instructions. Let me know if you find any problem with patch install.
    Regards,
    Ajay Kumar

  • 3rd gen iPod Nano will not sync with latest version of iTunes. It passes the connectivity test but not the sync test under diagnostics.  Worked fine on old Windows 7 laptop but not new one.  From Control Panel it shows up as an Apple iPod USB Device...

    3rd gen iPod Nano will not sync with latest version of iTunes on new laptop. It passes the connectivity test but not the sync test under diagnostics.  Worked fine on old Windows 7 laptop but not new one.  From Control Panel it shows up as an Apple iPod USB Device...

    Never mind, I think. I think I figured it out. There was 1 song (out of > 900!) that somehow had been purchased with the other ID - I have no idea how. Once I deleted that song, it stopped asking.
    There may be something with the newest iTunes version too. I didn't think in older versions that the "On this iPod" list of songs was greyed out. But at least it syncs ok.

  • Passing Printer as a parameter in the bursting control file

    One of our requirements is to print our report on different printers based on the user input. To acheive this, I am passing printer name as one of the parameter in our concurrent process. In the bursting java process, I set the properties as
    Properties prop= new Properties();
    prop.put("user-variable:PRINTER_NAME","ipp://146.141.12.128/printers/lp1");
    dp.setConfig(prop);
    dp.process();
    In the control file, I am pasing print delivery as :
    <xapi:print id="printer1" printer="$(PRINTER_NAME)" copies="1" />
    The system throws an error 'java string out of expection' and takes PRINTER_NAME as null in the print delivery. The same thing works perfeclty for E-Mail server if I pass name of the e-mail server in parameter and in the java and control file..I make the following changes:
    Properties prop= new Properties();
    prop.put("user-variable:SERVER_NAME","cns.wits.ac.za");
    dp.setConfig(prop);
    dp.process();
    <xapi:delivery>
    <xapi:email server="$(SERVER_NAME)" port="25"
    from="[email protected]" reply-to ="">
    <xapi:message id="123" to="${EMAIL}"
    Can anybody please help me with this..Has anybody tried passing printer as a parameter in the control file..

    Try curly brackets i.e. ${PRINTER_NAME} instead of $(PRINTER_NAME).
    Regards
    Ashish

  • How to pass this multi-value parameter via GoURL?

    Currency is equal to / is in 'USD', 'GBR', 'RUR'. How to pass such multi-value parameter via GoURL?
    P0=1&P1=eq&P2=Measures.Currency&P3=?

    Found. P0=1&P1=eq&P2=Measures.Currency&P3=3+USD+GBR+RUR

  • My phone does not want to come on pass the 'connect to itunes' logo.   I have a iphone 3Gs. It happened after I tried to restore it after updating it through itunes on my computer.

    My phone does not want to come on pass the 'connect to itunes' logo on the screen.  This happened after I was updating the phone software through itunes, and itunes said I needed to restore my phone if it is to work with itunes, which I did.  An error (1015) box popped up and... well.... here we are.  I have an iphone 3G.  The support coverage is expired. 
    I just want to return to my phone functioning as before.

    Was this iPhone jailbroken?

  • Is it possible to pass some type of parameter/unique id FROM PDF?

    hi there,
    I will try to explain this as best as I can but please bear with me.
    I have Adobe Acrobat X Pro.
    We have drawings linked to each other in pdf.
    When you open a drawing (say, a layout of a house), my boss wants to be able to click on say, a door, and have all the information on that door pop up (size, manufacturer, when it was shipped, etc). The information log is stored in Excel. I know how to hyperlink to open an excel file FROM pdf, but cannot figure out how to open a specific sheet in Excel. So here is my question:
    1. How do I link to a specific sheet in Excel so it opens when I click on a link in the pdf file?
    Having said that, we are going to have around 1500 items and I don't want to have to create 1500 sheets (if that's even possible) to open the details for each one. So here is question #2:
    2.  Is it possible to pass some type of parameter to excel (or even Access) to know what item was clicked on the pdf file so I can write a macro/code in Excel to just fill in the details for that item? (Hence just needing one sheet instead of 1500?).
    Suggestions/path forwards are welcome.
    I hope this was clear and I thank you in advance.
    Thanks,
    Jessica

    There really isn't a way to do that. It would be possible to export an Excel sheet to a tab-delimited (or CSV, XML) file which could optionally be attached to the PDF. JavaScript inside the PDF could read the data file and extract the information for an item so it could be displayed somehow.

  • Reg: passing wdEvent as a parameter .

    Hi All,
    I have a event handler method in my view. I am calling that method in some other method in the same view based on one condition by passing wdEvent as a parameter bcozz event handler methods have wdEvent as a parameter.
    for this I did
    com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent1 = null;
    wdThis.from_Summary_to_Individual( wdEvent1 );
    Can we do like this ? But it is giving error. What could be the reason.
    Is it bcozz I set it to null or other reason?
    Thanks in advance.

    Hi,
    Do you really need this parameter wdEvent for you processing?
    If not create a custom method and call if from both the places.
    You can create this method from the methods tab of the view.
    Regards
    Ayyapparaj

  • Can I pass a table function parameter like this?

    This works. Notice I am passing the required table function parameter using the declared variable.
    DECLARE @Date DATE = '2014-02-21'
    SELECT
    h.*, i.SomeColumn
    FROM SomeTable h
    LEFT OUTER JOIN SomeTableFunction(@Date) I ON i.ID = h.ID
    WHERE h.SomeDate = @Date
    But I guess you can't do this?... because I'm getting an error saying h.SomeDate cannot be bound. Notice in this one, I am attempting to pass in the table function parameter from the SomeTable it is joined to by ID.
    DECLARE @Date DATE = '2014-02-21'
    SELECT
    h.*, i.SomeColumn
    FROM SomeTable h
    LEFT OUTER JOIN SomeTableFunction(h.SomeDate) I ON i.ID = h.ID
    WHERE h.SomeDate = @Date

    Hi
    NO you cant pass a table function parameter like this?
    As When you declare @date assign value to it and pass as a parameter it will return table which you can use for join as you did it in first code 
    But when you pass date from some other table for generating table from your funtion it doesnt have date as it is not available there
    Ref :
    http://www.codeproject.com/Articles/167399/Using-Table-Valued-Functions-in-SQL-Server
    http://technet.microsoft.com/en-us/library/aa214485(v=sql.80).aspx
    http://msdn.microsoft.com/en-us/library/ms186755.aspx
    https://www.simple-talk.com/sql/t-sql-programming/sql-server-functions-the-basics/
    http://www.sqlteam.com/article/intro-to-user-defined-functions-updated
    Mark
    as answer if you find it useful
    Shridhar J Joshi Thanks a lot

  • Hoe to pass object as a parameter thru webSerive

    I need to pass Object as a parameter to web service:
    example:
    public calss returnCodes{
    int ret_code;
    String ret_string;
    public retrunCodes(int ret_code, String ret_string){
    this.ret_code = ret_code;
    this.ret_string = ret_string;
    public int getret_code()
    return this.ret_code;
    public String getret_string {
    return this,ret_string
    and other repc holder class to hold returnCodes
    public class retrunCodesHolder implents javax.xml.rpc.Holder
    returnCode value;
    pubic returnCodesHolder(){
    public returnCodesHolder(returnCodes value) {
    this.value = value;
    In Webservice I use returnCodesHolder as parameter.
    WebService getReturnCodesWs I have
    returnCodes retCodes = new returnCodes(04,"Good return code)
    returnCodesHolder retholder = new returnCodesHolder(retCodes)
    return myString;
    When I am calling above webService in servlet I have code:
    org.test.mytest.returnCodesHolder retHolder = new org.test.mytest.returnCodesHolder();
    String result = port.getReturnCodesWs(retHolder);
    How to I access /get values of returnCodes class in my calling servlet?
    I am using Tomcat v 6.0

    I believe (although have never used, so if I'm wrong,
    correct me please!) you can do it with implicit
    dynamic cursors, such as:
    For rec in 'select col1, col2 from table 1 '||lstr
    loop
    Not really:
    michaels>  declare
       lstr   varchar2 (30) := ' where empno = 7788';
    begin
       for rec in 'select * from emp e ' || lstr
       loop
          null;
       end loop;
    end;
    Error at line 1
    ORA-06550: line 5, column 4:
    PLS-00103: Encountered the symbol "LOOP" when expecting one of the following:
       . ( * @ % & - + / at mod remainder rem .. <an exponent (**)>
       ||

  • Can we pass epuser as a parameter?

    Hi,
    Can we pass epuser as a parameter to the Transactio iview or filed in the R3?
    While we creating an iview, application parameters or when we create in webdynpro ivew how can we pass? if how can and what can we write there?
    any help please.
    regards
    Kumar.

    Hi Kumar
    If you intend to send static parameter only, you can just pass it using the Application Parameter property of the iview.
    However, if you need to send dynamic parameters like user-id or something, you have to add and register a service to your existing appintegrator par file.
    Kindly follow this URL :
    The customer exit of the Application Integrator
    Regards,
    Nitin

  • RV042G cannot support more than 2-3 IPSec Pass through connections

    Hi,
    I'm trying to figure out what the max number of IPSec VPN pass through connections the RV042G can handle.  We bought an RV042G router to replace our old RV042 box which was running into connection limitations.  There are approximately 15 people in the office and anywhere from 5-8 of them need to vpn to a single client site.   There seems to be an issue with UPNP where it creates the proper port forwarding but doesn't associate it with an internal IP address.  Giving each workstation a static internal IP doesn't solve this issue.  The remote site we are connecting to does have NAT-T turned on.  What ends up happening is that after a while, users cannot vpn.  Sometimes it happens with fewer than three users.  Clearing the UPNP and rebooting the router helps but eventually if you connect and disconnect, a few times, you're hosed.   The UPNP doesn't release the setting it makes in a timely fashion.  Is there any way to fix this besides turning off UPNP which we need for other software to work?

    Lenovo support (for me in Canada at least) is based in Atlanta, so I'm surprised you found a tech with bad English...
    Your problems sound like windows problems, not hardware problems -- are you running XP or Windows7? If you google based on your OS, there are threads to be found on slowing down the start menu behaviors.

Maybe you are looking for

  • Mail, Address Book, iCal, Safari problems after 10.4.6 update

    Updated to 10.4.6 from 10.3.9 via purchased Tiger disks, and have been having problems with Apple basic applications. Address Book opens, then freezes and must Force Quit. iCal opens, then freezes and must Force Quit. Mail opens, but cannot retrieve

  • Old JSP pages loading // how to get new ones?

    I am new to the forum and hope that experts can help. I am running a JSP application on an Apache/tomcat setup. I encounter the problem that although I update a webpage (say 'example.jsp') with a date of 12 Jan 2009, the server continues to use a ver

  • OS 10.4.3 & 3rd party Wi-Fi PCI cards?

    OS 10.4.2 and Airport 4.2 'killed' PCI Wi-Fi cards from Linksys and others. Has anyone tested them with OS 10.4.3 to see if the problem has been fixed? Thanks

  • .flv in Dreamweaver

    I am trying to insert a .flv file into my Dreamweaver site. I have the Classroom in a Book for Dreamweaver CS5. I am doing exactly what the book is telling me I should be doing, but when I go to view the page in a browser, all I get is a white box wh

  • Sad icon

    I have checked the apple support page but nothing there explains what is happening to my iPod clickwheel. The icon goes from an Apple icon to a sad ico with an exclamation mark to a non-charging battery icon. I have tried to reset or restore and it k