How to get the connection string at runtime

Hi,
I'm using Forms6i.
I'm using EXEC_SQL to execute a dynamic sql in my form.
I need connection string for that . But i cannot give it hardcodingly.
Is there any form's properties to get the database connection string, to which the form is connected ?
Thanks

Hi,
I've the user i/p columns
EmpNo, Dept ,Holicode and , From and To Date.
In which From and To Date is mandatory.
In one table, emp_cal_header, i have all the holidays defined for each of the employees for a year.
The records like
EmpNo    Holicode     Holidt
001        Frioff         02/07/2011
001        Satoff        03/07/2011
001        Frioff         08/07/2011
.....So i want the final o/p in Excel like
If user i/p is from Date: 01/07/2011 ,ToDate:09/07/2011, EmpNo :001
EmpNo   Dept     Total  01/07/2011   02/07/2011 ..... 08/07/2011  09/07/2011
001        IT        3               FriOff           Frioff            For this i'm constructing a dynamic sql like this
     qry := '(Select ech_emp_code cal_emp_code,emp_name CAL_EMP_NAME,emp_dept CAL_EMP_DEPT,count(ech_date) CAL_TOTAL'||date_cols||'
                         from (Select ech_emp_code,em.emp_name||'' ''||em.emp_middle_name||'' ''||em.emp_last_name emp_name,em.emp_dept emp_dept,ech_code,ech_desc,ech_date
                                        from emp_cal_header ,employee_master em
                            where emp_cal_header.ech_emp_code = em.emp_code
                            and  ech_emp_code = '||nvl(:emp_code,'ech_emp_code')
                            ||' and em.emp_status IN (''P'',''C'')'
                            ||' and em.emp_dept = '||dep
                            ||' and ech_date between '''||to_date(to_char(:From_dt,'DD-MON-YYYY'))
                            ||''' and '''  ||to_date(to_char(:To_dt,'DD-MON-YYYY'))
                            ||''' and ech_code = '||holi
                            ||' order by ech_Date)
             group by ech_emp_code,emp_name,emp_dept)';
and date_cols is constructed as
     todt := :from_dt ;
     i := 0;
     loop
          i := i+1;
          dt  := to_char(todt,'dd-MON-YYYY');
          date_cols     := date_cols||','||'max(decode(to_char(ech_date,''dd-MON-YYYY''),'''||dt||''',ech_CODE)) DT'||i;
          todt := todt + 1;
          Exit when todt > :to_dt ;
     End loop;This query i'm executing using EXEC_SQL.
Since date_cols can be constructed only based on user i/p , i'm not able to do just a normal query
Any help

Similar Messages

  • How to determine the connection string to a SQLite database, in C# code

    Hello. I'm trying to figure out how to specify the connection string to a SQLite database, I would like to access using the following code:
    string connectionString = null;
    SqlConnection connection;
    SqlCommand command;
    SqlDataAdapter adapter = new SqlDataAdapter();
    DataSet ds1 = new DataSet();
    string sql = "SELECT DataName, Data, Id, UserId, DateLastUpdated FROM MainTable";
    connectionString = "Data Source=C:\\SQLITEDATABASES\\SQLITEDB1.sqlite;Version=3;";
    connection = new SqlConnection(connectionString);
    try
    connection.Open();
    command = new SqlCommand(sql, connection);
    catch
    The value I assigned to the variable connectionString, in the code above, I obtained somewhere from the Internet. It does not work. I'm using Visual Studio 2013, against the file sqlite-netFx451-setup-bundle-x86-2013-1.0.96.0.exe, which
    I installed, and got from
    here.
    My application's App.config file looks as follows:
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <configSections>
    </configSections>
    <connectionStrings>
    <add name="DC_Password_Saver.Properties.Settings.DC_Password_SaverConnectionString" connectionString="data source=&quot;C:\Users\patmo_000\Documents\Visual Studio 2013\Projects\DC Password Saver\DC Password Saver\DC Password Saver.db&quot;" providerName="System.Data.SQLite.EF6"/>
    </connectionStrings>
    <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
    </startup>
    </configuration>
    I tried to use the value assigned to connectionString in the XML settings above, replacing single backslash characters with double backslash characters, because the Visual Studio editor flagged them as unrecognizable, and wound up with the
    following.
    SqlDataAdapter adapter = new SqlDataAdapter();
    DataSet ds1 = new DataSet();
    string sql = "SELECT DataName, Data, Id, UserId, DateLastUpdated FROM MainTable";
    connectionString = "data source=&quot;C:\\Users\\patmo_000\\Documents\\Visual Studio 2013\\Projects\\DC Password Saver\\DC Password Saver\\DC Password Saver.db&quot;";
    connection = new SqlConnection(connectionString);
    The above code however does not work either. So again, does anyone know how I can specify in C# code, a connection string to access my SQLite database? Thanks in advance for your reply.

    What does SQLite connection strings has to do with WPF?
    You will find some valid connection strings here:
    https://www.connectionstrings.com/sqlite/
    But you cannot use the SqlConnection class to connect to a SQLite database. You will need to download and add a reference to the System.Data.SQLite library and then use the SQLiteConnection class:
    connection = new System.Data.SQLite.SQLiteConnection(connectionString);
    try
    connection.Open();
    command = new System.Data.SQLite.SQLiteCommand(sql, connection);
    catch
    Please refer to the following article for more information and an example of how to connect and read and write data from an SQLite database using C#:
    http://blog.tigrangasparian.com/2012/02/09/getting-started-with-sqlite-in-c-part-one/.
    There is contains a link where you can download the required assemblies.
    Hope that helps.
    Please remember to mark helpful posts as answer to close your threads and then start a new thread in an approproate forum if you have a new question.

  • How to find the CONNECTION STRING

    how to find the connection string through SQL Statement?
    salahuddin/salahuddin@CONNECTION_STRING
    Below is all about my sql version:
    DEFINE SQLPLUSRELEASE = "800060000" (CHAR)
    DEFINE _EDITOR         = "Notepad" (CHAR)
    DEFINE OVERSION = "Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options" (CHAR)
    DEFINE ORELEASE = "1002000100" (CHAR)

    In windows XP plateform your can find from the ServicesHow can you do that using SQL statement? Plus connect strings are not available in Services. In post 9i SQL*Plus we can do it in SQL statement like this
    SELECT '&&_CONNECT_IDENTIFIER'
    FROM dual;
    Note: This will work only in SQL*Plus.

  • How to get the connection name of a Dataprovider

    Hi,
         I have a report with stored procedure dataprovider.Now I need to write a VBA script to get the connection name of this dataprovider.Is it possible to get the connection name of dataprovider?
    Thanks
    Rakul.

    What product are you using? Are you using Crystal Reports? Business Objects Enterprise? SAP product(s)? You sure you are asking in the correct forum?
    Ludek

  • BC4J HOW Can I GET the CONNECTION String

    hi everyone
    I'm using Jdev 3.2. In my BC4J prooject I want to get the current connection String used by the application module to connect to database.
    can some one help me please.
    Ghassen

    I don't know what's really the problem, but I recomplie the same code and I receive the same error.
    I added also the import statement: import oracle.dacf.dataset.connections.NamedConnection.
    and I receive the same error message.
    can that be a mising library problem?
    ghassen
    null

  • How to get the connection with PM in sequencefactory?

    In SequenceFactory interface the following method
    public long getNext(Class cls, Connector connector)
    is to get the next sequence number, and one can use the connector to get a
    new connection, but at most time, when the kodo call this method, there
    must a PM exist, so if I want to use the connection with the exist PM, not
    a new connection, how can I get to it!

    Maguohai-
    You can't do this with datastore identity, but you could use application
    identity, and have the id assigned wherever use want, using SQL executed
    via a Connection obtained in the way described at:
    http://docs.solarmetric.com/manual.html#feature_sql_connection_access
    In article <bc0n3c$n9l$[email protected]>, maguohai wrote:
    Yes, you are right, but if generate the sequence need not transaction(for
    example using DBMS SEQUENCE OBJECT to get the sequence), and I don't want
    one application contains two connection at the same time. Is the any way I
    can do?
    Marc Prud'hommeaux wrote:
    Maguohai-
    The SequenceFactory implementation should use a second Connection in order
    to manipulate sequence numbers, since the transactional boundry for
    the sequence increment should not be bound to the transactional boundry of
    the PersistenceManager.
    In article <bbu83a$knd$[email protected]>, maguohai wrote:
    In SequenceFactory interface the following method
    public long getNext(Class cls, Connector connector)
    is to get the next sequence number, and one can use the connector to get a
    new connection, but at most time, when the kodo call this method, there
    must a PM exist, so if I want to use the connection with the exist PM, not
    a new connection, how can I get to it!
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • How to get the infoobject name in runtime?

    Hi,
    I have a variable which is used by several queries. I can get the query name at run time through using the SAP memory (IMPORT compid = lv_compid FROM MEMORY ID 'COMPID'.).
    Now I want to get the Infoobject name in run time, is that possible through the same way?When yes, what is the memory ID?
    When no, how can I get it in RUN Time?
    best regards

    Hi,
    no, I m not using customer exit. I m using master data read class.
    When the user klick  the search help of the variable by the beginning of the query, the masterdata class will be called. I want to get the infoobject name of the variable in this class in run time 
    thanks
    best regards

  • How to get the connected Adapter Object for a particular BDoc Type?

    Hi All,
    I have a scenario in which CRM system is connected to ERP system.
    In SMW01 transaction, I can see one BDoc with BUS_TRANS_MSG as the BDoc Type in CRM.
    Now, how do I get to know if this one BDoc is a SALESDOCUMENT or SALESCONTRACT.
    Is there any way thorough which I can get to know the Adapter Object for this particular BDoc.
    Regards,
    Madhuri

    Hi Madhuri,
               Happy new year.
    In Transaction : R3AC1.
    You can observe the Linked BDOC for the adaptor objects. For example Sales docuemnt and Sales contrcat will have the same linked BDOC as "BUS_TRANS_MSG".
    If you see an error in SMW01, you want to find whether it is salesdocument or contract.
    1. Please take the Queue name from SMW01.
    from the queue name you can find whether it is sales contract or sales document.
    Queue name is customized in tables: SMOFQFIND.
    I hope this helps you.
    regards,
    Sri...

  • How to get the connected screen off when connected

    When I connect my iPod nano (4th gen - I believe) to both my car (through the AUX jack with a USB cord) and to my computer, the screen that says "Connected Eject before disconnecting" comes up and won't go away - even after it syncs and everything. In the car, it will plays some music but since I can't see my screen or any of my playlists I can't change the song or anything from the iPod. On the computer, I can click the eject button and the screen goes away and all if fine except that it obviously isn't connected and then won't sync. When the iPod isn't connected to the computer or the car it works fine. HELP!

        Hello, ghost3947-
    I am sure this would be quite frustrating! Let's take a look at that! Please ensure there is no debris in the HDMI port on the device. If dust, lint, etc get in that port, it can cause these sort of glitches. After you verify the port is clear, and it continues, please move on to a factory hard reset (http://tinyurl.com/9bgrztr) to resolve the concern. After the reset, the phone will walk you through activation and signing back into Google services. Keep me posted!
    Thanks,
    AdamE_VZW
    Follow us on Twitter @VZWSupport

  • How to get the query name in runtime?

    Hi,
    I have a variable which is used in several queries.
    How can I figure out which query is using the variable?
    can anyone help?
    thanks and regards

    HI,
    thanks for your qickly reply.
    Perhaps I should decribe my situation more clearly.
    I m trying to retrict the F4 seach help values depending on the calling query.
    Example: Qurey A and B both have the variable V
    if A is running, the search help should give the values 1,2,3  back
    if B is running, the search help should give the values 4,5,6  back.
    There is a BADI (RSR_VARIABLE_F4_RESTRICT_BADI) that should restrict the search help values, but the button can not call the BADI.
    So I m trying to use the META DATA READ CLASS to restrict the values on the info object level when the varial is used by a query.
    The function modul RRM_SV_VAR_WHERE_USED_LIST_GET can give me the list of qurey name which has the variable, but can not tell me which one is calling the variable at run time.
    My question is actually how  I can figure out which query IS USING  the variable in RUNTIME.
    Thanks and Regards

  • How to get the connection with timeserver

    Hi I displayed time(GMT) in my program with Date class, but it gives local time. But I need the UTC/GMT time.
    Date date=new Date();Is there any way to get GMT?
    And I have Internet connection......

    Date date = new Date();
    DateFormat df = DateFormat.getInstance();
    System.out.println(df.format(date));
    df.setTimeZone(TimeZone.getTimeZone("GMT"));
    System.out.println(df.format(date));~

  • CallableStatement: how to get prepared call string?

    How can I get the parameter string that is set via prepareCall() from a CallableStatement?
    String call = "{call sp_irecord (?,?,?)}";
    CallableStatement cs = connection.prepareCall(call);
    //later, when 'call' is not known but cs:
    String originalCall = csc.get???();
    //how to get the call string from the callable statement?

    i don't mean the parameter names or values, i mean the string that you set with the prepareCall() method:
    String call = "{call sp_irecord (?,?,?)}";
    CallableStatement cs = connection.prepareCall(call);
    System.out.println("Call string: "+cs.getCallString());with the method getCallString() (that i invented and that i'm looking for) should return the exact string. The output of the example above should be:
    Call string: {call sp_irecord (?,?,?)}

  • How to get the querystring in jsp

    hi guys
    plz help me,
    how to get the query string in jsp page, is there any methods for getting querstring like getString() getParameter() ?

    C:\Documents and Settings\Administrator\ven\build\generated\src\org\apache\jsp\getcustomer_jsp.java:62: getQueryString() in javax.servlet.http.HttpServletRequest cannot be applied to (java.lang.String)
    i am getting error like this , if i used that method, shall i import any packages?

  • How to get the viewrow value by string

    Using Jdev11.1.1.5.0-adfbc-ireport3.0.0
    here i'll describe: what i did.
    am using jsff(dynamic region) while hitting the af:tree nodes it will opens. ok fine
    i had somevo with manually wroten query. and query is fine no problem with that
    here i give sample not a original query
    select * from sometable where acctid = :pacctidi drag and drop the pacctid from corresponding execute params vo as selectoncechoice
    static vo
    Data value - account payable , advance
    Data Name - ap,ad
    in that jsff
    *page representation*
    account type :   account payable (ap) - select one choice type
                            advance           (ad) - select one choice type
    like this some select once choice and some inputs.
    Run report - command button
    .jsff code
    <af:selectOneChoice value="#{bindings.ACCT_TYPE.inputValue}"
                              label="Account Type"
                              shortDesc="#{bindings.ACCT_TYPE.hints.tooltip}"
                              id="soc3" required="true"
                              autoSubmit="true"
                              binding="#{backingBeanScope.SUP1040V.soc3}"
                              valuePassThru="true"
                              valueChangeListener="#{backingBeanScope.SUP1040V.ValueChangeListener1}">
            <f:selectItems value="#{bindings.ACCT_TYPE.items}" id="si3"/>
          </af:selectOneChoice>
    <af:commandToolbarButton text="Export in pdf" id="ctb2">
              <af:fileDownloadActionListener method="#{backingBeanScope.SUP1040V.Report}"
                                             />
            </af:commandToolbarButton>.java
         //while hitting the button following logs are appeared i show it as commented format.
        public void Report(FacesContext context, OutputStream out) throws IOException,Exception
                FacesContext ctx = FacesContext.getCurrentInstance();
                HttpServletRequest request =
                    (HttpServletRequest)ctx.getExternalContext().getRequest();
                HttpServletResponse response = 
                    (HttpServletResponse)ctx.getExternalContext().getResponse();
                BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry();
                System.out.println("print binding" +bindings1 );
    //while using sop i get this in my log : :  print binding  ReportsPageFragments_SUP1040VPageDef_WEB_INF_TaskFlows_SUP1040_V_TF_xml_SUP1040_V_TF
                JUCtrlListBinding listBinding1 = (JUCtrlListBinding)bindings1.get("ACCT_TYPE");
                System.out.println("print list bindings" +listBinding1 );
    //while using sop i get this in my log : :  print list  bindings0
                Object selectedValue1 = listBinding1.getSelectedValue();
                System.out.println("print selected value" + selectedValue1);
    //while using sop i get this in my log : :  print selected  valueViewRow [oracle.jbo.Key[AP ]]   
    request.setAttribute("ACCT_TYPE", //here i want the value  "AP" in  String  );
    if i use like this means
    request.setAttribute("ACCT_TYPE", soc1.getValue()  );  i get the index value.
    i need the dataname "ap" so i go above method which say wrotes ...
                request.getRequestDispatcher(response.encodeURL("/sup1040servlet")).forward(request,response);
                System.out.println("hihihihih");
                response.flushBuffer();
                ctx.responseComplete();
        public void ValueChangeListener1(ValueChangeEvent valueChangeEvent) {
            // Add event code here...
            String AcctType = valueChangeEvent.getNewValue().toString();
            System.out.println("AcctType" + AcctType);
            FacesContext contxt = FacesContext.getCurrentInstance();
            valueChangeEvent.getComponent().processUpdates(contxt);
           BindingContainer bindings1 =
           BindingContext.getCurrent().getCurrentBindingsEntry();
           // Get the sepecific list binding
           JUCtrlListBinding listBinding1 =
           (JUCtrlListBinding)bindings1.get("ACCT_TYPE");
           // Get the value which is currently selected
           Object selectedValue1 = listBinding1.getSelectedValue();
           System.out.println(selectedValue1);
        }if i get ap means my report runs. or else it will shows empty page.
    how to get the viewrowimpl class value as string.
    Edited by: ADF7 on Mar 24, 2012 7:27 AM

    ADF7,
    I'm not sure I understand what you are up to.
    As far as I understand you want to get the display value instead of the index
    I use this code
        public void StatusChangedListener(ValueChangeEvent valueChangeEvent)
            BindingContext lBindingContext = BindingContext.getCurrent();
            BindingContainer lBindingContainer = lBindingContext.getCurrentBindingsEntry();
            JUCtrlListBinding list = (JUCtrlListBinding) lBindingContainer.get("Status");
            int newindex = (Integer) valueChangeEvent.getNewValue();
            Object row = list.getDisplayData(); // Wichtig um die liste zu laden!!!!
            Row lFromList = (Row) list.getValueFromList(newindex);
            Object lAttribute = lFromList.getAttribute("Value");
            String newVal = (String) lAttribute;
        }to get the value from a selectOneChoice component...
    Timo

  • How to get the field name of an internal table during runtime?

    How to get the field name of an internal table during runtime?

    Hi  Sudhir,
    Declare and Use Get Cursor Field in Your Prm to get the field Name of the Intenal Table
    Example Code:
        <b>  DATA: v_field(60).                        " Insert this code.
         GET CURSOR FIELD v_field.        " Insert this code.</b>
         <b>CHECK v_field = 'ITAB-KUNNR'.    " Insert this code. (or)
    Write: v_field.</b>
    Regards,
    Ramganesan K.

Maybe you are looking for

  • Question about import with Lr 5.4 update

    I did the Lr 5.4 update... where did the "import subfolders" option go (at import)?  I have the main folder, I imorted that...then I went back and imported a subfolder that is saved within that main folder.  BUT now the sub folder images are all show

  • Palm T/X

    hullo! can anyone tell me how to completely erase or purge on palm? I would like to give it to my wife but she needs to create her own user name and stuff, free and clear of my info... please help Thanks!

  • Regarding BMM Layer MultiLTS

    I have D1 and F2 which is no join between them. But I have D2 which is joined with F1 and F2. so, I made an logical fact table and add F1 and F2, then join with both D1 and D2 Create the Hierarchies for both D1 and D2 and set the content as detail fo

  • Weblogic hangs after running few hours

    Hi! We have encountered the following errors with Oracle when runing weblogic for few hours. What should we do in order to identify the problem? Wed Feb 14 14:48:19 CST 2001:<I> <VCBOProductMgr::updateTransactionStatus> Updating status of transaction

  • SONGS WON'T COPY TO IPOD

    For the first time (I've had iTunes and an iPod for a long time), I'm getting an error message when I sync my iPod that says that "[s]ome of the items in the iTunes library...were not copied to [my iPod] because you are not authorized to play them on