Database connection(select ,insert query) within javascript function

Hi ,
How to write the database connection(insert,delete or select query) within javascript function.Is it possible.Anyone can you help me
than you

Hi ,
How to write the database connection(insert,delete
ete or select query) within javascript function.Is it
possible.No

Similar Messages

  • Performance issues with respect scheme registration,select & insert query

    I am facing performance issues with respect to schema registration,Select & insert query towards 10.2.0.3 version.It is taking around 45 minutes to register schema and it is taking around 5 min to insert a single document into xml db where as it was taking less than min to insert a single document into xml db of 9.2.0.6 version.Would like to know the issue and solution to resolve this issue.Please help me out on this as it is very urgent for me

    Since it appears that this is an XML DB specific question, you're probably better off posting in the XML DB. The folks over there have much more experience with the ins and outs of that particular product.
    Justin

  • Make this select query to Select Insert query

    Hi,
    How to make this select query to select Insert query..
    ;WITH DateDim AS
    SELECT CAST('1900-01-01' AS DATETIME) StartDate
    UNION ALL
    SELECT StartDate + 1
    FROM DateDim
    WHERE StartDate + 1 <= '2099-12-31'
    SELECT CAST(CONVERT(CHAR(8),CAST(StartDate AS DATETIME),112) AS INT) AS DateKey
    , StartDate
    , DATEPART(dw, StartDate) AS DayNumberOfWeek
    , DATENAME(dw, StartDate) AS EnglishDayNameOfWeek
    , DAY(StartDate) AS DayNumberOfMonth
    , (CASE WHEN MONTH(StartDate)>=1 AND MONTH(StartDate) <=6 THEN 1 ELSE 2 END) AS CalendarSemester
    FROM DateDim 
    OPTION (MAXRECURSION 0) 
    GO

    The final solution is                            
     ;WITH DateDim AS
    SELECT CAST('1900-01-01' AS DATETIME) StartDate
    UNION ALL
    SELECT StartDate + 1
    FROM DateDim
    WHERE StartDate + 1 <= '2099-12-31'
    SELECT CAST(CONVERT(CHAR(8),CAST(StartDate AS DATETIME),112) AS INT) AS DateKey
    , StartDate
    , DATEPART(dw, StartDate) AS DayNumberOfWeek
    , DATENAME(dw, StartDate) AS EnglishDayNameOfWeek
    , DAY(StartDate) AS DayNumberOfMonth
    , (CASE WHEN MONTH(StartDate)>=1 AND MONTH(StartDate) <=6 THEN 1 ELSE 2 END) AS CalendarSemester
    Into new_tablenameFROM
    DateDim 
    OPTION (MAXRECURSION 0) 
    GO

  • LabVIEW Database Connectivity Toolkit Parameterized Query Property Wildcard

    Hi,
    within my LabVIEW application I successfully implemented a SQL statement
    like
    SELECT *
    FROM table_name
    WHERE property 1 = 123
    AND property2 = "abc"
    with help of the Database Connectivity Toolkit. I first created a parameterized
    query, then set each parameter and afterwards executed this query.
    But now I want to use wildcards within this statement. Does anybody know
    how to use wildcards with both integer properties and string properties?
    Is this possible while using the normal parameterized query vi?
    Thanks in advance for your help.
    Regards
    Michael

    Hi Michael
    You can use "LIKE":
    SELECT * FROM table_name WHERE property 1 LIKE '12%'
    % represents multiple characters (e.g. entries with property 1 123 but also 1240 would be selected)
    _ represents one character
    Hope this helps.
    Thomas
    Message Edited by becktho on 09-05-2005 11:57 AM
    Using LV8.0
    Don't be afraid to rate a good answer...

  • ORA-14551 Call to a proc that performs INSERT from within a FUNCTION

    Anyone,
    I have written a number of functions that serve to convert an old_value to a new_value. But there are some times when the conversion fails. I wish to log those exceptions into a table and move on. I undertand FUNCTIONS are not to insert data but that is why I created a PROC and want to be able to call it from within the FUNCTIONs.
    Is there any way to get around the ORA-14551 error?
    Here is what I have:
    CREATE OR REPLACE FUNCTION MAXIMO.fcn_get_worktype
      ( worktype_IN IN varchar2,
        siteid_IN IN varchar2)
      RETURN  varchar2 IS
      var_worktype varchar2(5);
    BEGIN
         IF siteid_IN IN ('ML','OK','BE') THEN
            BEGIN
                 SELECT NVL(NEW_WTYPE,NULL)
                INTO var_worktype
                 FROM MAXIMO.MAX411_WBK_WORKTYPE$
                 WHERE OLD_WTYPE = worktype_IN;
            EXCEPTION
                WHEN NO_DATA_FOUND THEN
                    MAXIMO.SP_CONVERSION_EXCEPTION('WORKTYPE', 'WORKTYPE', worktype_IN, siteid_IN);
                    var_worktype := 'XX';
                     RETURN var_worktype;
            END;
        END IF;
        RETURN var_worktype ;
    END;And here is my PROC:
    CREATE OR REPLACE PROCEDURE MAXIMO.sp_conversion_exception (table_IN IN VARCHAR2, column_IN IN VARCHAR2, value_IN IN VARCHAR2, tab_ID IN VARCHAR2)
    IS
    BEGIN
        INSERT INTO MAXIMO.MAX411_CONVERSION_EXCEPTIONS
             ( TABLE_NAME,
             COLUMN_NAME,
             VALUE ,
              TAB_ID)
        VALUES
             ( table_IN,
             column_IN,
             value_IN,
              tab_ID );
        EXCEPTION
            /* If value was already recorded then do not record again, Key is on all three columns */
            WHEN DUP_VAL_ON_INDEX
                THEN
                    NULL;
        COMMIT;
    END;Can anyone shed any light on how I can stop getting:
    ERROR at line 1:
    ORA-14551: cannot perform a DML operation inside a query
    ORA-06512: at "MAXIMO.SP_CONVERSION_EXCEPTION", line 5
    ORA-06512: at "MAXIMO.FCN_GET_WORKTYPE", line 16
    ORA-01403: no data found
    ORA-06512: at "MAXIMO.LOAD_PM", line 181
    ORA-06512: at line 1
    Thanks in advance for any help I can get...
    Miller

    You need a PRAGMA AUTONOMOUS_TRANSACTION in your exception procedure, eg:
    CREATE OR REPLACE PROCEDURE MAXIMO.sp_conversion_exception (table_IN IN VARCHAR2, column_IN IN VARCHAR2, value_IN IN VARCHAR2, tab_ID IN VARCHAR2)
    IS
      PRAGMA AUTONOMOUS_TRANSACTION
    BEGIN
      ...

  • Use netui tags within javascript function

    Is there anyway to use netui tags within a javascript function? I am trying to create a onChange event handler for a netui:select tag that will call a javascript function which will execute a few netui callMethod tags. The problem is that if the netui tags are embedded within a javascript function they are not translated into javascript. Is there some kind of function that I can wrap the embedded netui tags with so that they will be translated into javascript at runtime? Thanks.

    Hi,
    I am trying to embed JSP code within javascript
    t function, so that it can be called when the user
    leaves the page. No,you can't.
    JSP files are complied on server side while the javascript is the clint side code.
    if you really want to call the functio when the user leaves the page, you can call a function runs on the server side to set the session.
    regards

  • Help with doing SELECT sub query within the SET of an UPDATE statement

    After doing some research, it appears as if it's possible to use a SELECT subquery in the SET of an UPDATE statement.  i did find some examples and here is my code, however when I click the "check" button it's saying the field (my entire select subquery) is unknown and neither in one of the specified tables or defined by a "DATA".  Do I have a syntax issue or is there another reason why it's not taking this as a valid statement?  Thanks for the help!
    LOOP AT IT_DATA
    UPDATE /BIC/AZDP_O0140
       SET /BIC/ZCOUNTER = (SELECT COUNT( DISTINCT MATERIAL )
                            FROM /BIC/AZDP_O0140
                            WHERE MATERIAL EQ IT_DATA-MATERIAL
                            GROUP BY MATERIAL).
    ENDLOOP.

    my Update does indeed have a WHERE clause but because of the issue i'm having, all my criteria in my WHERE is black text in the ABAP editor.  The editor doesn't even recognize the keywords "WHERE" or "EQ".  Below is my entire statement which contains all WHERE criteria in both the Update and the Subquery, i've just removed it for testing to help simplify the query and eliminate as many other factors as posisble that may be causing problems:
    LOOP AT IT_DATA.
       UPDATE /BIC/AZDP_O0140
       SET /BIC/ZCOUNTER = (SELECT COUNT( DISTINCT MATERIAL ) FROM /BIC/AZDP_O0140
       WHERE WHSE_NUM EQ IT_DATA-WAREHOUSE
        AND  PLANT EQ IT_DATA-PLANT
        AND  /BIC/ZTRAN_NO EQ IT_DATA-TRANS_NUM
        AND  DELIV_NUMB EQ IT_DATA-DELIVERY
        AND  MATERIAL EQ IT_DATA-MATERIAL
        GROUP BY MATERIAL)
       WHERE WHSE_NUM EQ IT_DATA-WAREHOUSE
        AND  PLANT EQ IT_DATA-PLANT
        AND  /BIC/ZTRAN_NO EQ IT_DATA-TRANS_NUM
        AND  DELIV_NUMB EQ IT_DATA-DELIVERY
        AND  MATERIAL EQ IT_DATA-MATERIAL.
    ENDLOOP.
    i should also mention the sources i found were not within the SAP Library but instead on other third-party ABAP websites.  so because i was having issues i wanted to post here to see if anyone else has come up with a working solution.  but if this cannot be done i can likely come up with a solution for my needs using multiple internal tables, this would just have been much easier since i can get a query like this to do what i want in SQL Server.  Thought i could utilize this in ABAP as well.

  • Insert query using fn-bea:execute-sql() function

    Hi ,
    How to use sql insert query in Xquery function fn-bea:execute-sql().
    Could you please anyone help me on this.
    Regards
    Rajesh.

    Hi
    Can i use stored procedure in that function to include insert query?
    could you please suggest me on this.
    Please provide some links or tutorial on that.
    Regards
    Rajesh

  • Select list display value in javascript function

    Hi All,
    I have a select list in a tabular form having a display value & return value.
    I am using $x(var_name).value or $v(var_name) for retreving return value of the select list in a javascript function.
    Can anyone let me know how can I get the display value of the select list in a javascript function? Im using Apex 3.2
    Thanks & Regards,
    Sandeep

    What if the select list is not an item. Select list I am talking about is in a tabular form.Regardless of how they're generated in APEX, in JavaScript they're all DOM nodes. There are many ways of accessing the node of the required element. Consider the Items for Order... tabular form on page 29 of the Sample Application:
    var productNameLOV = document.wwv_flow.f04[0] // select list containing name of product on first order line
    var productNameLOV = $x("f04_0001") // another way of accessing the same node, using the ID attribute generated by apex_itemWe can see this using the Safari console:
    => productNameLOV = document.wwv_flow.f04[0]
        <select name="f04" id="f04_0001" autocomplete="off">…</select>
    => productNameLOV = $x("f04_0001")
        <select name="f04" id="f04_0001" autocomplete="off">…</select>Once you've got the node&mdash;however you get it&mdash;you then use the methods shown above:
    => i = productNameLOV.selectedIndex
        3
    => productNameLOV.options.text
    "Business Shirt [$50]"
    So it appears you would use:var item = document.wwv_flow.f01[i];
    var selected = item.selectedIndex;
    var selectedOption = item.options[selected].text;
    This is meaningless:...
    var my_var = document.wwv_flow.f01[i].id; // f01 is tabular column of select list
    if ($x(my_var) == 'display_value') //$x(my_var) is having return value, but i need display_value there
    <tt>$x(my_var)</tt> returns a DOM node object, whilst <tt>'display_value'</tt> is a string: they are not comparable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Cfquery within javascript

    hi,
    I am trying to do the following:
    I wrote a cfquery within javascript function as below:
    <script language="javascript1.2" type="text/javascript">
    <cfquery name="query1 datasource="abc">
    </cfquery>
    <cfif query1.recordcount neq "0">
        <cfoutput query = "query1">
           <cfquery name="query2 datasource="abc">
      select * from table1 where name=#query1.name#
           </cfquery>
        </cfoutput>
         alert(<cfoutput>#query2.RecordCount#</cfoutput>);
    </cfif>
    </script>
    The alert value is 1 but the debugging section shows 0, and 0 is the correct value. is there something wrong that I am doing.
    If so can you please point out...

    The problem comes from how CF and JS work: Coldfusion is a "Server Side" language while Javascript is "Client Side". This means the server runs through all the CF code in your page and sends the finished product on to the user's browser which THEN starts handling the Javascript.
    I'm not sure of your intended outcome ... do you want a series of "alerts" as soon as the page loads? If you are using the alert for debugging (just to see what is being returned, you can replace it with <p> tags and you will see the output on screen. Try this:
    <cfif query1.recordcount neq "0">
         <cfoutput query = "query1">
              <cfquery name="query2 datasource="abc">
              select * from table1 where name=#query1.name#
              </cfquery>
              <p>#query2.RecordCount#</p>
         </cfoutput>
    </cfif>
    2 more notes:
    you don't the inner "cfoutput" around you record output if you are going to use cfoutpu to loop over your query.
    the output line needs to be INSIDE the loop or you'll only output the last iteration.

  • Select Insert into staging table does not load varchar2

    I have a select insert query that loads a prebuilt table. I am running this query through Heterogenous services which points to a MySql database.
    If I run just a select query in SQL PLUS then it returns all rows just fine.
    However, when I put the select insert into a stored procedure, compile it, then run it. It does not load any VARCHAR2 datatypes but it does load DATE and NUMBER datatypes.
    I also have another table with VARCHAR2 and it loads fine.
    How can the database only load some of the items in a row and not others (VARCHAR2)
    For instance, the query will load TRANSACTION_ID, ORER_NUMBER but will not load any data into BILLFIRST_NAME, and their is data to load.
    CREATE TABLE "TRAN_STG"
    (     "TRANSACTION_ID" NUMBER(11,0),
         "ORDER_NUMBER" NUMBER(20,0),
         "BILL_FIRST_NAME" VARCHAR2(100 BYTE),
    Any suggestions would be appreciated.

    can it be that there are differences in characterset? Can it be that there are differences in datatypes? Can it be that there are differences in field length?

  • Opening multiple reports in Crystal Reports for VS causes database connect limit to be reached.  Seems to be no way to force Crystal Reports to close database connection (other than exiting application)

    I am working on upgrading an application that has been in use for many years.  The application is written in VB6 and I have been tasked with upgrading the current application to Crystal Reports for Visual Studio.  I am using Crystal Reports for VS Version 13.0.12.1494.  The system's database is a Sybase SQL Anywhere 16 database with an ODBC connection using integrated login.  Each of the reports has the database connection set up from within the report.  There is only once database server, so each of the reports are pointing to the same DB.  The database server is currently installed as a "Personal Server" with a limit of 10 connections. 
    I have implemented the CR viewer as part of a COM-callable wrapper that exposes a COM interface for VB6 to interact with.  Inside of my viewer component is a Winform that embeds the Crystal's Report viewer.  The COM interface basically maps the basic Crystal apis to methods that the VB6 can call (i.e., Load Report, Set Field Text, Update SQL Query, etc).  This architecture is working as designed and the reports are displaying correctly and responding correctly to changes in queries, etc.
    The issue is that after I open 9 reports, the tenth one will respond with an error indicating that the database connection limit has been reached.  The database connections used by the reports aren't released until after the application is closed.  The application is designed for a secure environment that prohibits the non-administrative user from accessing the systems desktop, so asking the user tor restart the application after 10 reports isn't a viable option.
    I have checked and database connection pooling is turned off for the SQL Anywhere 16 driver.
    I have been digging on this for a few days and have tried adding code in the FormClosed event to close and dispose of the Report Document as follows:
    ReportDocument reportDoc= (ReportDocument) crystalReportViewer1.ReportSource;
    reportDoc.Close();
    reportDoc.Dispose();
    GC.Collect();       // Force garbage collection on disposed items
    I have also tried the following (as well as maybe 20 or so other permutations) trying to fix the issue with no success.  
    ReportDocument reportDoc= (ReportDocument) crystalReportViewer1.ReportSource;
    foreach (Table table in reportDoc.Database.Tables)
         table.Dispose();
    crystalReportViewer1.ReportSource = null;
    reportDoc.Database.Dispose();
    reportDoc.Close();
    reportDoc.Dispose();
    reportDoc = (ReportDocument)crystalReportViewer1.ReportSource;
    GC.Collect();       // Force garabe collection on disposed items
    Any ideas or suggestions would be greatly appreciated.  I have been pulling my hair out on this one!

    Hi Ludek,
    Thanks so much for the quick reply.  Unfortunately I did not have time to work on the reporting project Friday afternoon, but did a quick test this morning with some interesting results.  I'm hoping if I describe what I'm doing, you can show me the error of my ways.  This is really my first major undertaking with Crystal Reports.
    If I simply load the report, then close and dispose, I don't hit the limit of 10 files.  Note that I do not logon manually in my code as the logon parameters are all defined within the reports themselves.  The logon happens when you actually view the report.  Loading the report doesn't seem to actually log in to the DB.
    What I did was create a very simple form with a single button that creates the WinForm class which contains the Crystal Viewer.  It then loads the report, sets the ReportSource property on the CrystalReportsViewer object contained in the WInForm and shows the report. The report does show correctly, until the 10 reports limit is reached.
    The relevant code is shown below. More than I wanted to post, but i want to be as complete and unambiguous as possible. 
    This code displays the same behavior as my earlier post (after 10 reports we are unable to create another connection to the DB).
    // Initial Form that simply has a button
      public partial class SlectReport : form
            public SelectReport()
                InitializeComponent();
            private void button1_Click(object sender, EventArgs e)
                ReportDocument rd = new ReportDocument();
                ReportForm report = new ReportForm();
                try
                    rd.Load(@"Test.rpt");
                    report.ReportSource = rd;
                    report.Show();
             catch (Exception ex)
                  MessageBox.Show(ex.Message);
    // The WinForm containing the Crystal Reports Viewer
        public partial class ReportForm : Form
            public ReportForm()
                InitializeComponent();
            private void Form1_Load(object sender, EventArgs e)
                this.crystalReportViewer1.RefreshReport();
                this.FormClosed += new FormClosedEventHandler(ReportForm_FormClosed);
            void ReportForm_FormClosed(object sender, FormClosedEventArgs e)
                ReportDocument rd;
                rd = (ReportDocument)crystalReportViewer1.ReportSource;
                rd.Close();
                rd.Dispose();
            public object ReportSource
                set { crystalReportViewer1.ReportSource = value; }
    Again, any guidance would be greatly appreciated. 

  • Jdbc insert query hangs

    We have 2 instances of the same program running in parallel. The application inserts data to a database table. one of the instance just hangs when it is trying to insert a query to database i.e. when executing statement.executeUpdate(). We are using a prepared statement to bind all parameter values. Instance 1 keeps running but instance 2 hangs and goes in a waiting state.
    Is there any suggestions on how can this issue be investigated. I know a possible reason for hanging could be database lock, but I cannot understand, how it can have a database lock for insert query.
    oracle : 9.2.0.7
    java : jre 1.4

    user551224,
    Are you running two separate Threads that both use the same database connection?
    This issue has been discussed previously in this forum.
    Search the forum archives for more details.
    It could also be because of a database lock.
    Are you trying to insert rows into the same table?
    You could try using the FOR UPDATE NOWAIT clause to verify.
    Good Luck,
    Avi.

  • Can i write java code in JavaScript function

    I want to call JavaBeans within JavaScript function. Can I do it?
    I have a button in JSP . When the button be clicked,the data be inputted will be checked by JavaScript function. If check is ok, then call a Bean's function to write the data to database.
    Please Help!

    well indeed u can write java code in javascript functions. But probably it will not work the way u want it to.
    when u say that u click a button, it means that some client side action is performed. Now if u wud require a java bean to be called then it means that the server needs to be contacted for the same, and if that has to be done, necessarily the form needs to be submitted.
    U can populate values from a java bean and then the same can be made available to a javascript variable / function when the page is loaded rather than, when the button is clicked.
    What u can do is on click of button u can process [display / calulate..etc ] the information which has already been got by the java bean.
    Kris

  • Slow database connection with mysql

    I am using MySQL Server 5.0 as my backend and java1.5 as my front end for the GUI. The following statements I use to connect to MYSql.
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    String url = "jdbc:mysql://localhost:3306/mysql";
    The database access seems to be very slow.
    I have a data file with about 3000 lines. The parser reads the file one line at a time, formats an insert query and calls executeUpdate. The process takes more than 2 minutes.
    What is slowing down my process? Please help
    Thanks

    I am using MySQL Server 5.0 as my backend and java1.5
    as my front end for the GUI. The following statements
    I use to connect to MYSql.
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    String url = "jdbc:mysql://localhost:3306/mysql";
    The database access seems to be very slow.
    I have a data file with about 3000 lines. The parser
    reads the file one line at a time, formats an insert
    query and calls executeUpdate. The process takes more
    than 2 minutes.
    What is slowing down my process? Please help
    ThanksHi,
    1. Are you opening and closing the database connection ,During inserting every record from data file?
    If so, please avoid opening closing connection for each query execution.
    Because , opening and closing the database connection is a time consuming one.
    You should open all the required database connections, before you use them or use
    Database connection pooling if your application is sucah a big one.
    2. Try PreparedStatment instead of Statement. Because Prepared statment query is
    compiled and stored into Cache. so if you are executing the same query again and again, the compiled query will be picked up from cache, by replacing with new
    parameters
    3. Check the logic you used to pick record from datafile and insert into database .
    4. Check your RAM size , if you installed database and jvm on same machine.
    if so , increase your RAM size.
    thanks,
    nvseenu

Maybe you are looking for

  • Question on sending JPEG Files as attachments in MAIL

    It seems that no matter what method I try for attaching an actual JPEG file to an email in Mail, I end up sending the image, not the actual file. Is there a trick to doing this I have not found yet, or does Mail under Leopard only send images? Docume

  • How do you stop the video dimming?

    Sorry if this has been asked before. I searched and searched. On the X-Fi 32GB, is there a way to stop video from automatically dimming? Thanks.

  • Flex automation

    Hey Guys , Anyone knows how to automate a flex application that loads modules at runtime. I have a flex application that has a swf file that loads 3 different modules at runtime (3 swfs). How can I compile such flex application for automation. Is it

  • Can't move music to iPhone after reinstalling OS.

    I was on a 64 bit Windows 7 OS and I had to be reimaged to a 32 bit. I tried moving music over to my iPhone and it doesn't let me. I authorized this computer, but I'm not sure what that did. What am I missing?

  • Client not installing

    I just joined my current organization 7 days ago.  The previous person has installed SCCM 2012 last November but has since then left.  It is not fully functional.  In looking at the Devices list, I can see that all servers have clients in them, some