TOP 10 SQL QUERIES

Hi,
How can i find the top 10 sql queries which consuming high IO, CPU's. in oracle db.
I am doing in one way that by using TOP command trying to get PID's then i am getting the sql query by applying the hash value in v$sqlarea.
Is there any way to get directly high consumed IO and CPU's with out seeing PID's in TOP command.
Thansk

hi,
try something along the lines of
select c.* from
    (select disk_reads,
            buffer_gets,
            rows_processed,
            executions,
            first_load_time,
            sql_text
       from v$sqlarea
       where parsing_user_id !=0
       order by
          buffer_gets/decode(executions,null,1,0,1,executions) desc ) c
where rownum < 11;
select c.* from
    (select disk_reads,
            buffer_gets,
            rows_processed,
            executions,
            first_load_time,
            sql_text
       from v$sqlarea
       order by
          disk_reads/decode(rows_processed,null,1,0,1,rows_processed) desc ) c
where rownum <11;or even
--Top 10 by Buffer Gets:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
        buffer_gets, executions, buffer_gets/executions "Gets/Exec",
        hash_value,address
   FROM V$SQLAREA
  WHERE buffer_gets > 10000
ORDER BY buffer_gets DESC)
WHERE rownum <= 10
--Top 10 by Physical Reads:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
        disk_reads, executions, disk_reads/executions "Reads/Exec",
        hash_value,address
   FROM V$SQLAREA
  WHERE disk_reads > 1000
ORDER BY disk_reads DESC)
WHERE rownum <= 10
--Top 10 by Executions:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
        executions, rows_processed, rows_processed/executions "Rows/Exec",
        hash_value,address
   FROM V$SQLAREA
  WHERE executions > 100
ORDER BY executions DESC)
WHERE rownum <= 10
--Top 10 by Parse Calls:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
        parse_calls, executions, hash_value,address
   FROM V$SQLAREA
  WHERE parse_calls > 1000
ORDER BY parse_calls DESC)
WHERE rownum <= 10
--Top 10 by Sharable Memory:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
        sharable_mem, executions, hash_value,address
   FROM V$SQLAREA
  WHERE sharable_mem > 1048576
ORDER BY sharable_mem DESC)
WHERE rownum <= 10
--Top 10 by Version Count:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
        version_count, executions, hash_value,address
   FROM V$SQLAREA
  WHERE version_count > 20
ORDER BY version_count DESC)
WHERE rownum <= 10
;you may have to play around with the column formatting a little to show the best results
regards
Alan
Edited by: alanm on Dec 22, 2008 4:01 PM

Similar Messages

  • Urgt:How to identify TOP 5 SQL using more CPU time  without using statspack

    How to identify the TOP 5 SQL queries which are consuming more CPU time during the timespan of 24 hours for entire database. There are N number of users who have issued sql queries, out of which few users have disconnected and few user are still connected to the database(I need to consider all sessions). My database version is 9.0.1. I don't want to use statspack. Is there any way to identify TOP 5 SQL consuming more CPU time without affecting the performance of the database. Can any one help me on this? Its urgent!!. I don't want to use statspack becasue it degrades the performance and i cannot afford to run it for 24 hours.

    You don't run statspack for 24 hours, that would infact be pointless...
    Run statspack for say a 10 or 15 minute window during a particular "busy" period on your database. If you run it for longer then all the useful data will have been "averaged out". You want a snapshot in time, not an average over the day.

  • How to identify TOP 5 SQL consuming more CPU time without using statspack

    How to identify the TOP 5 SQL queries which are consuming more CPU time during the timespan of 24 hours for entire database. There are N number of users who have issued sql queries, out of which few users have disconnected and few user are still connected to the database(I need to consider all sessions). My database version is 9.0.1. I don't want to use statspack. Is there any way to identify TOP 5 SQL consuming more CPU time without affecting the performance of the database. Can any one help me on this? Its urgent!!.

    My database version is 9.0.1. I don't want
    to use statspack. Is there any way to identify TOP 5
    SQL consuming more CPU time without affecting the
    performance of the database. Can any one help me on
    this? Its urgent!!.I cant understand why you dont want to use statspack. As it is very easy to use and very quick to identify bottlenecks. Try using statspack. Its really wonderful.
    Particularly in your case statspack is the best.
    Regards,
    Sanju.

  • Top 10 SQL's  by Physical reads

    Dear experts,
    Oracle version - 11.1.0.7
    Do we have a way to pull top 10 SQL's (physical reads) for a 24 hour period based on AWR data or other V$ views.
    Thanks

    From DBA_HIST_SQLSTAT, all you can tell is who the parsing user was.
    Not the executing user.
    So for queries which are executed multiple times by multiple users, DBA_HIST_SQLSTAT is insufficient and there's no great solution.
    You could have a look in the underlying ASH data - V$ACTIVE_SESSION_HISTORY and DBA_HIST_ACTIVE_SESS_HISTORY which is respectively sampled data and a sample of a sample and it might give an indication of who is executing.
    Edited by: Dom Brooks on Jul 19, 2012 10:18 AM
    Part of sentence was missing

  • Top  Expensive SQLs

    I have following query to identify top expensive sql statements.
    SELECT Substr(a.sql_text,1,50) sql_text,
    Trunc(a.disk_reads/Decode(a.executions,0,1,a.executions)) reads_per_execution,
    a.buffer_gets,
    a.disk_reads,
    a.executions,
    a.sorts,
    a.address
    FROM v$sqlarea a
    ORDER BY 2 DESC
    However, I have a need to fetch corresponding session information that are running these queries. Is there a way I can connect v$sqlarea with v$session?
    Thanks,
    R

    You should use hash_value and sql_address as there can be more sqls with same hash value but different address.
    This might give you some idea for improvement:
    -- sessions and other useful stuff                                                             
    SELECT   s.SID SID, s.serial# serial, s.status status,
             (i.block_gets + i.consistent_gets) logical_reads,
             i.consistent_gets consistent_gets, i.block_gets block_gets,
             i.physical_reads physical_reads,
             (i.block_changes + i.consistent_changes) block_changes,
             NVL (DECODE (TYPE,
                          'BACKGROUND', 'SYS (' || b.NAME || ')',
                          s.username
                  SUBSTR (p.program, INSTR (p.program, '('))
                 ) oracle_user,
             s.process client_pid, s.machine machine, p.spid server_pid,
             NVL (s.osuser, '(' || b.NAME || ')') os_user,
             s.program client_program, s.logon_time logon_time,
             s.username user_name, s.module module,
             q.sql_text,
             s.sql_address sql_address, s.sql_hash_value sql_hash_value
        FROM v$session s,
             v$process p,
             v$sess_io i,
             v$bgprocess b,
             v$sqlarea q
       WHERE p.addr = s.paddr
         AND i.SID = s.SID
         AND p.addr = b.paddr(+)
         AND q.address(+) = s.sql_address
         AND q.hash_value(+) = s.sql_hash_value
         AND TYPE != 'BACKGROUND'
    ORDER BY user_nameThis will work also on older versions of the database <= 9i.
    HTH, Joze
    Co-author of the forthcoming book "Expert Oracle Practices"
    http://www.apress.com/book/view/9781430226680
    Oracle related blog: http://joze-senegacnik.blogspot.com/
    Blog about flying: http://jsenegacnik.blogspot.com/
    Blog about Building Ovens, Baking and Cooking: http://senegacnik.blogspot.com
    Edited by: Joze Senegacnik on 10.12.2009 0:27

  • Top 20 SQLs

    Can anyone please help me to find out Top 20 SQLs.
    We can have some TOPs from statspack but i want to know if there is any view from which we can find out the desired information.
    If possible please wirte the query also.

    Hi Oraguy,
    Can anyone please help me to find out Top 20 SQLs.You can write your own queries to display the top-n SQL (where executions > xxx), or adjust the STATSPACK collection thresholds:
    http://www.dba-oracle.com/t_statspack_snapshot_top_sql_collection_internals.htm
    An example of one of the SQL reports is seen below. Note the sections marked in red. The SQL must exist in stats$sqlsummary, and must be in this table for both the begin and end snap value.
    select aa, hv
    from ( select /*+ ordered use_nl (b st) */
    decode( st.piece
    , 0
    , lpad(to_char((e.buffer_gets - nvl(b.buffer_gets,0))
    ,'99,999,999,999')
    ,15)||' '||
    lpad(to_char((e.executions - nvl(b.executions,0))
    ,'999,999,999')
    ,12)||' '||
    lpad((to_char(decode(e.executions - nvl(b.executions,0)
    ,0, to_number(null)
    ,(e.buffer_gets - nvl(b.buffer_gets,0)) /
    (e.executions - nvl(b.executions,0)))
    ,'999,999,990.0'))
    ,14) ||' '||
    lpad((to_char(100*(e.buffer_gets - nvl(b.buffer_gets,0))/:gets
    ,'990.0'))
    , 6) ||' '||
    lpad( nvl(to_char( (e.cpu_time - nvl(b.cpu_time,0))/1000000
    , '9990.00')
    , ' '),8) || ' ' ||
    lpad( nvl(to_char( (e.elapsed_time - nvl(b.elapsed_time,0))/1000000
    , '99990.00')
    , ' '),9) || ' ' ||
    lpad(e.old_hash_value,10)||''||
    decode(e.module,null,st.sql_text
    ,rpad('Module: '||e.module,80)||st.sql_text)
    , st.sql_text) aa
    , e.old_hash_value hv
    from stats$sql_summary e
    , stats$sql_summary b
    , stats$sqltext st
    where b.snap_id(+) = :bid
    and b.dbid(+) = e.dbid
    and b.instance_number(+) = e.instance_number
    and b.old_hash_value(+) = e.old_hash_value
    and b.address(+) = e.address
    and b.text_subset(+) = e.text_subset
    and e.snap_id = :eid
    and e.dbid = :dbid
    and e.instance_number = :inst_num
    and e.old_hash_value = st.old_hash_value
    and e.text_subset = st.text_subset
    and st.piece <= &&num_rows_per_hash
    and e.executions > nvl(b.executions,0)
    and 100*(e.buffer_gets - nvl(b.buffer_gets,0))/:gets > &&top_pct_sql
    order by (e.buffer_gets - nvl(b.buffer_gets,0)) desc, e.old_hash_value, st.piece
    where rownum < &&top_n_sql;

  • Erratic Report Region Behavior with Dynamic SQL Queries

    I'm running HTMLDB v 1.5.1.00.12 and I've noticed some odd behavior with report regions using dynamic SQL queries. Every so often, our testers will run a page containing a dynamic sql report region and get the following error, (despite the fact the query was working only moments ago and no other developer has touched it):
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    or sometimes
    failed to parse SQL query:ORA-01403: no data found
    The only solution I've found so far is to:
    1) Make a copy of the failed report region.
    2) Disable or delete the original failed report region.
    The new copy of the report region runs without issue.
    My search of the forums turned up the following two threads, but neither provided me with a clear explanation of the cause, and how to avoid it:
    ORA-06502:PL/SQL: numeric or value error: character string buffer too small
    Re: Import Export Error (ORA-06502)
    The columns being returned are below the 4000 character limit, and the rows being returned are far less than 32k in size.
    Could this have anything to do with the way HTMLDB is internally storing the PL/SQL used to generate the dynamic SQL Query? Is there any known issue related to this with that version of HTMLDB?
    This problem occurs without any discernable pattern or consistency, making it hard to determine where I should focus my efforts in tracking down the cause.

    Hi all,
    My report seems to be behaving correctly once i set it to "Use Generic Column Names (parse query at runtime only)" :)
    Cheers,
    Joel

  • Error while running the sql queries in unix as cron job..

    Hi,
    I've configured some sql queries to run as cronjob from unix,i'm able to excute all the sql queries with out any error,after all the queries are executed,I'm getting the following error message.
    ORA-00600: internal error code, arguments: [4080], [1], [131], [], [], [], [],
    Could any one advise me why this error is being thrown?
    How to avoid this error?
    Thanks,
    Anil

    Are you running these queries through TopLink?
    If so, the error seems to be occurring on the database, when the query is being executed.
    I have never seen that error before. Performing some websearches it seems to be a general database error, potentially something to do with synchronization. Sorry I can't be of more help, perhaps the database forum can provide more insight...

  • Need help in SQL Queries using GUI controls or variables

    Hello, all
    I have a big problem (I have already had with Visual Basic a few mounths ago) with Java while writing my SQL Queries.
    I would like to know how I must do to use variable data or GUI control data in my SQL Query to select only some records.
    Here, my first Query that works without any problem (no WHERE clause !!!) :
    Statement requeteBedes = connectBedes.createStatement();
    ResultSet resultatSeries = requeteBedes.executeQuery("SELECT * FROM Series");
    initComboBoxSeries(resultatSeries);the method "initComboBoxSeries" fills a JComboBox with all the names of the series in my database.
    Here comes my problem.I would like to use the value of the selected "series" in the JComboBox to search in another table of the same Database. I made another statement but it returns a Null ResultSet :
    ResultSet resultatSearchAlbumsFromSeries = requeteBedes.executeQuery("SELECT * FROM bandes_dess WHERE  ser_nom = '" + strComboBoxSeriesSelected + "' "); The variable strComboBoxSeriesSelected contains the value of the selected line in the combobox with all the series, filled after the first query that is here above and that works very well.
    Could some one help me and tell me how I must use variables or GUI controls values in my SQL Queries or tell me if there is a place where I could find an explanation of that kind of problems (like more "advanced SQL Queries", as the ones currently used in all the Learning Java 2 books)
    Thank you all for your help.
    Christian.

    executeQuery() will never return null. At least that's what the spec says. You are probably catching an exception (probably a syntax error caused by a single quote in strComboBoxSeriesSelected) and ignoring it. Or do you mean the ResultSet contains no rows?
    Anyway, to use parameterized queries, take a look at PreparedStatements. Your code should look like this using PreparedStatement:Statement requeteBedes = connectBedes.prepareStatement("SELECT * FROM bandes_dess WHERE  ser_nom = ?");
    requeteBedes.setString(1, strComboBoxSeriesSelected);
    ResultSet resultatSeries = requeteBedes.executeQuery();Alin.

  • How to get the SQL queries based on SQL_ID.

    Hi Experts,
    I want to get the SQL queries based on SQL_ID.
    I have tried the following query,but I am not getting full query.
    [code]SET linesize 132 pagesize 999
    column sql_fulltext format a60 word_wrap
    break on sql_text skip 1
    SELECT   REPLACE (TRANSLATE (sql_text, '0123456789', '999999999'), '9', ''),sql_id
    FROM   dba_hist_sqltext s
    WHERE   s.sql_id = '7tvurftg8zryb';[/code]
    One of my friend said use grid to get full query text.
    Can you please help me how to use grid ,else any other method to get the full query based on SQL_ID.
    Please help me.
    Thanks in advance.

    You have these many options to set, if sql_text is really huge. But better use a tool(TOAD) as it's really helpful and easy to use instead! (See my previous comment).
    column sql_text format A10000
    set echo off
    set head off
    set feed off
    set verify off
    set termout off
    set lines 10000
    set long 1000000
    set trimspool on
    set pages 0
    Thanks!

  • Developing portlets for dummies (sql queries)

    Hello, I've been trying to build a dynamic menu. First I went with just plain old plsql: i created a function in the portal schema that returns an unordered, nested list of the pages in my pagegroup and called that function in a regular pl/sql item on my portal page. I did this by querying the wwpob_page$ table and that went just great in my test&development setup (of which I am the admin of course :))
    Then I realized that since I'm not an administrator of the server hosting our portal and I only have very limited privileges (I am only a page group administrator) I will probably not be allowed to utilize this function nor will they agree to install it in the portal schema, and I decided I should build a portlet that does the same thing (so it can be registered and so on, and so it can use the synonyms and tools that are available to registered providers). There already is such a portlet (and provider) registered for use in the target portal, but I don't like it because i uses tables and hard-coded styles so I will cook my own, better version. :)
    So I downloaded an example portlet and am getting the hang of it, but now I just can't for the life of me figure out how to enable any sql-queries. I have run the provsyns-.sql script, logged in as test_provider/portal and installed my portlet-package as test_provider user. I can see the available pl/sql packages in Toad, but there are no tables or views for me to to see. That means I can't query the portal tables that I need to.
    edit: ok, stupid user error; I suck at using Toad, so I was looking at the wrong schema altogether :D So now i see the public views and packages, so forget that bit of the question.
    But still, I cannot see even wwsbr_all_folders -view, much less the wwpob_page$ -table. I cannot see any way to find the pages that are in my page group. Somehow it must be doable, right?
    Have I done something wrong, missed a step in enabling my test-provider / schema perhaps? I don't really know what I'm doing, but I followed instructions here: http://home.c2i.net/toreingolf/oracle/portal/my_first_plsql_portlet.htm (excellent instructions, thanks!)
    So should my portlet be able to access those tables or not? How the heck has the third partly portlet maker done it?
    i'm on OracleAS Portal 10g Release 2 (10.1.4)
    Edited by: Baguette on 23-Apr-2009 05:13
    Edited by: Baguette on 23-Apr-2009 05:32

    i see your perspective now. and let me give a perspective to my first reply too.
    what i proposed to you was the answer of what i quoted in the message. that is, why didn't you see those views in the new schema you created! and it is still ok but it is done in the portal schema for which you should have privielges too and i assumed you had. my mistake!
    now, i can relate your privacy concerns with your earlier message:
    Hello, I've been trying to build a dynamic menu. First I went with just plain old plsql: i created a function in the portal schema that returns an unordered, nested list of the pages in my pagegroup and called that function in a regular pl/sql item on my portal page. I did this by querying the wwpob_page$ table and that went just great in my test&development setup (of which I am the admin of course :))
    +Then I realized that since I'm not an administrator of the server hosting our portal and I only have very limited privileges (I am only a page group administrator) I will probably not be allowed to utilize this function nor will they agree to install it in the portal schema, and I decided I should build a portlet that does the same thing (so it can be registered and so on, and so it can use the synonyms and tools that are available to registered providers). There already is such a portlet (and provider) registered for use in the target portal, but I don't like it because i uses tables and hard-coded styles so I will cook my own, better version. :)+
    +So I downloaded an example portlet and am getting the hang of it, but now I just can't for the life of me figure out how to enable any sql-queries. I have run the provsyns-.sql script, logged in as test_provider/portal and installed my portlet-package as test_provider user. I can see the available pl/sql packages in Toad, but there are no tables or views for me to to see. That means I can't query the portal tables that I need to.+
    - by downloading an example portlet, you probably mean you created a new schema. because provsyns work on a schema.
    - if you are not the administrator of the portal, and may not be able to access some portions of the portal, it means that you do not use the portal user (the user which serves as the owner of the portal schema).
    - now, your plan to create a new schema and give those privielges would still not work. because, by creating a new schema you cannot sneak in to the oriignal portal schema if you do not have privileges to do it. obvious, right? otherwise, it would be a vulnerability of the software that you can see what you are not allowed to see by creating a new schema.
    - however, there is a bright side here. the views give records based on your privileges.
    - so if your administrators have generated them already or if they generate on the original portal schema, then you may see the pages and items that you have privileges to see and no more.
    so now, you may ask the administrators if they have already done it, and if not, then if they would be willing to do it.
    hope that helps!
    AMN

  • Ruby code for sql queries

    Hello everybody,
    First off, let me apologize if my inquiry does not belong on this forum. I am confident however, that someone here has had experience with this since Oracle and ruby on rails/ruby are used frequently. My fingers are crossed, here's is my problem:
    I am currently working on a database system that utilizes ruby on rails
    with a oracle database. Here's the situation:
    the ruby on rails web application is up and running;
    my oracle database is full of tables that are populated with data;
    there is a successful connection between rails and my oracle database;
    however, what isn't finished is I currently have data mining queries in
    sql (eg. find minimum time someone has been employed = "Select
    min(time) from table...etc") and what I need to do is write one ruby
    program for each of my sql queries so that the ruby program:
    1) connects to the oracle database each time the query is called
    2) runs the sql query on the oracle database
    3) takes the results from the query and returns them in an array or
    something of that nature (so that I can use the results in an html file
    on the ruby on rails web application).
    Again, I apologize if this question does not belong on this forum. If someone however has experience with this could you please give me example code of what this would look like (using different sql queries). Thank you

    I apologize if this question does not belong on this forum. OTN does have a forum dedicated to Ruby/Ruby On Rails. I admit it doesn't seem to get much traffic. I think that's because most people working with Ruby tend to go for F/OSS products.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

  • SQL queries parser.

    Hello,
    I have quite strange question related to my research.
    Probabley within Oracle DB there is some dynamic library which is parsing SQL queries,
    for example.
    SELECT * FROM schema.table which is able to extract informations from SQL listed above that we want to display all columns from selected table.
    When this construction is valid ( SQL standard ) the next step is verification the object existence in DB. It means
    that there are two separated actions which are analyzing queries.
    I need only first part of that process, which will give me informations about all object used in SQL query
    is it possible to accomodate that internal parser witin stand alone middleware like Weblogic Event Server ?
    I can do it with regular expression patters, but it's not going to be fast and effective for subqueries and all advanced
    constructions for DHW like MODEL, etc.
    Thank You,
    R.

    >
    http://search.cpan.org/~rehsack/SQL-Statement-1.23/lib/SQL/Statement.pm
    BUGS AND LIMITATIONS ^
    * currently we treat NULL and '' as the same - eventually fix
    * No nested C-style comments allowed as SQL99 says
    >
    That's the reason why I want to use dedicated for 11g EE library ;-)
    Thanks for quick reply

  • ? in SQL Queries and not using prepared statements

    Using EclipseLink 1.1.1
    Prepared Statements are disabled
    In our production server something went wrong and one of our Read Queries started erroring. A DatabaseException was thrown and we log the "getQuery.getSQLString()" statement. We found this query in the logs:
    SELECT t1.ID, t1.NAME, t1.DESCRIPTION, t1.EXTREFID, t1.STYLESHEET, t1.DDSVNVERSION, t1.FIRSTNAME, t1.LASTNAME, t1.EMAILADDR, t1.PHONENUMBER, t1.ADDRESS, t1.ADDRESS2, t1.CITY, t1.STATE, t1.POSTALCODE, t1.COUNTRY, t1.ADMINACCTNAME, t1.HASDOCUMENTS, t1.HASTIMEDNOTIFICATIONS, t1.STATUS, t1.ENTRYDATE, t1.EVALEXPDATE, t1.LASTREMINDDATE, t1.FULLUSERS, t1.LIMUSERS, t1.REQUSERS, t1.ISENTERPRISE, t1.EXPDATE, t1.ISDISABLED, t1.DISABLEDDATE, t1.NEEDLICENSEAGREEMENT, t1.ISWARNINGDISABLED, t1.LOCALE, t1.TIMEZONE, t1.CURRENCY, t1.DOMAIN, t1.DOCUMENTSIZE, t1.EXTRADOCUMENTSTORAGE, t1.ONDEMANDOPTIONS, t1.SSOTYPE, t1.RESELLERID, t1.ACCOUNTREPID, t1.LASTUSAGEREPORTDATE, t1.NEXTUSAGEREPORTDATE, t1.USAGEREPORTATTEMPTS FROM T_SSOOPTIONS t0, T_CUSTOMERS t1 WHERE *((((t0.SSOENABLED = ?) AND (t1.SSOTYPE IN (?, ?))) AND (UPPER(t1.DOMAIN) = ?)) AND (t0.CUSTOMERID = t1.ID))*
    Notice the values weren't entered into the where clause. We had to bounce the application to fix the problem. I've never seen this before. I've added more debugging statements to the code - so if this happens again in the future I'll have more information to report on. In the mean time I'm wondering if anyone else has every seen a problem of this nature.

    Database error due to invalid SQL statement.
    I don't have a stack, we were catching the exception and not printing the stack :(
    Like I mentioned in my first post, I added more debugging code (e.printStackTrace()). I understand this is hard to track down without more information. I was just hoping you guys had seen something like this before and had any insight. Like I mentioned before: this is on our production server. I've never seen this type of error before. That particular server (we run in a cluster mode) had been up for several days and then started generating that error. IT bounced the node and everything went back to normal. We have been using toplink for about 5 years now and have never seen this problem, until August 3rd 2009. The only thing that has changed recently is our migration from toplink 10 to EclipseLink. I was wondering if anyone knows if anything had changed in EclipseLink/toplink 11 with the generation of SQL queries.
    I'll keep looking. There is more debugging code in there now. Since the error was "Database error due to invalid SQL statement" this implies the SQL was generated, exited that part of the code and was sent to the db where it failed. I'm afraid the printStackTrace won't help if this error happens again.

  • SQL queries in JSP

    Does anyone know how to create a JSP which allows the user to input data into a simple database and then allow the user to input SQL queries? I can do this in a servlet but must hard code the query. It would be great to be able to type in differnet queries to see the results.
    Thanks
    Michael

    hai,
    I am giving u a small example which allows user to enter data in the html page and the same is submitted by the Jsp page in the database.
    <%@ page language="java" import="java.sql.*" %>
    <html>
    <body bgcolor="#FFd08d" >
    <%!     Connection conn;
         Statement st,st1;
         ResultSet rs,rs1;
         int i,j;
    %>
    <%     
         try{
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              conn=DriverManager.getConnection("jdbc:odbc:--DSNName--","--DataBaseUserName--","--DataBasePassword--");
         catch(Exception e)
    %>
         Error in Saving : <%=e%>
    <%
         try
         String email_address=request.getParameter("email_address");
         String query_text=request.getParameter("query_text");     
         PreparedStatement st=null;
         String inst="insert into databasename..DataBaseTableName(email_address,query_text) values (?,?)";
         st=conn.prepareStatement(inst);
         st.setString(1,email_address);
         st.setString(2,query_text);
         st.executeUpdate();
         conn.close();
    %>
    Your query is Submitted.<br>
    Thanks.
    <%
         catch(SQLException e)
    %>
    Error in Saving : <%=e%>
    <%
    %>          
    </body>
    </html>
    I think this will solve ur query.
    bye
    sameer

Maybe you are looking for

  • Very dim screen on MacBook Pro - how to prove it?

    I bought an MBP about 4 weeks ago (just before the new rev came out, so this one does not have LED backlight) and have mostly been using it connected to a 23" cinema display. When I was using the built-in screen the other day I realised it was very d

  • USB problem connection with NOKIA N95 8GB

    Hey, I have a big problem with my device... Before a few months I did not have any problems with my connections via Widows XP, Windows Vista... When I plug USB connection everything is OK and the comp found my nokia hard! But now It does not work! I

  • Please help me out tell me the differnce

    I have two statements like UPDATE WCOWNER.WC_EXT SET INVCE_STATUS='Error-UPDF' WHERE EXT_CD IN (SELECT SOURCE_SYSTEM_REFERENCE_ID FROM FFTD3_BILL_INTER_HEADER_GENER) above query is working in sql editor this fine and problem is with simple procedure

  • I disabled my iphone 5. how do you fix it. i for got my passsword.

    i disabled my iphone 5. how do you fix it. i for got my passsword.

  • Set cursor on table control not working

    Hi,   I have a screen with delivery number field on top with Get Data Button next to it. Once I click on Get Data, I want to get all the handling units and show them in a table control below and show the first line of that table control selected by d