Slow result set
I have a ResultSet with ruffly 7000 rows and 28 columns, the last column of which is an oracle.sql.ARRAY with at most 1800 rows itself. I get the ResultSet from a callable statment with the out paramater of type oracle.jdbc.driver.OracleTypes.CURSOR. I'm having trouble parsing through the set. As I'm parsing (resultSet.next()), after every tenth record it stalls for 5 sec, I assume it's because weblogic is fetching 10 more records. I tried changing the fetch size from 10 to 1000 but got an out of memory error(I have plenty of memory allocated, 500Mb). I also changed the prefetch feature, and set the chunk size to 6000 on the console. I really need this to be faster, any ideas? Thank you for your time.
Hi Michael,
Generally it's better to process large amounts of
data at the DB server. Have you considered moving
that processing a stored procedure?
Regards,
Slava Imeshev
"Michael Garland" <[email protected]> wrote in message
news:3bcf31d5$[email protected]..
I have a ResultSet with ruffly 7000 rows and 28 columns, the last columnof which is an oracle.sql.ARRAY with at most 1800 rows itself. I get the
ResultSet from a callable statment with the out paramater of type
oracle.jdbc.driver.OracleTypes.CURSOR. I'm having trouble parsing through
the set. As I'm parsing (resultSet.next()), after every tenth record it
stalls for 5 sec, I assume it's because weblogic is fetching 10 more
records. I tried changing the fetch size from 10 to 1000 but got an out of
memory error(I have plenty of memory allocated, 500Mb). I also changed the
prefetch feature, and set the chunk size to 6000 on the console. I really
need this to be faster, any ideas? Thank you for your time.
Similar Messages
-
Unbearably slow result sets. Please help.
I'm trying to draw data out of a read-only Omnis database and migrate it into a mysql database, and the process is really, really slow. The biggest transfer involves moving a paltry 3117 rows of data. This alone takes some 10 minutes O_o. Something is amiss, and I've traced the bottleneck to the resultset recursion. I get a funky resultset out of omnis when using the JDBC-ODBC bridge [I don't even have access to column headers, and therefor can't index them via getXXX(String s)]. I weeded through these forums and someone having similarly slow (though not to this degree) performance moving things out of mysql was advised to limit the resultset fetch size via a call to
stat = con.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
stat.setFetchSize(1);
I've tried this, but it keeps on throwing an exception.
SQLException: java.sql.SQLException: Invalid Fetch Size
Any thoughts would be greatly appreciated.To clarify, (I probably used the wrong term) I meant iterating down a resultset via calls to resultset.next().
I did a couple more tests, however, and found that it is not the calls to next() that are the problem, but the getXXX()'s. I made a little program that accessed the omnis database, ran a select * on a table of 90 rows, displayed the first five entries in each row, and counted each row as it was output to the screen. Anyway, my findings were that, in 10 seconds the program had moved through a paltry 47 rows of the omnis database. As a control, I ran the exact same program against the MySQL database, and got all 3117 rows of output in around 4 seconds... I also ran the same program against omnis without the outputs, and it ran at an appreciable speed. I am therefor forced to conclude that the problem lies in the way it handles gets... is there anything I can do about this? -
Urgent! Slow Result Set -- temp table slowing me??
-- Running BC4J/JHeadstart/UIX
Description:
I have a uix page that calls a Servlet and passes a TABLE_NAME. The Servlet gets the TABLE_NAME and calls a class that extends oracle.jheadstart.persistence.bc4j.handler.DataSourceHandlerImpl to create a ViewObject and get the data we need. Once the ViewObject is passed back to the servlet, the servlet loops through the VIewObject and builds a report. See the problem below and the code at the bottom.
Problem:
I am running a query that returns approx 5000 records to my ViewObject. I then loop through the rows and construct a report. The view object will return the first 1085 records quickly, however, the following 4000 come back very slowly. I read online that BC4J creates temp tables to store large resultsets and then streams the data to the user as you need it. Is this our potential bottleneck?
Questions:
Is there a way to have it return all the rows? What can I do to speed this up?
Code:
--- Begin Servlet Snippet ---
private ByteArrayOutputStream createReport(HttpServletRequest request)
try{
// PARM_REPORT = table name
String reportName = request.getParameter(PARM_REPORT);
System.out.println(">> calling getReport for " + reportName);
RdmUserHandlerImpl handler = new RdmUserHandlerImpl();
ViewObject vo = handler.getReportView2(reportName, request.getSession().getId());
System.out.println(">> back from get report");
// loop through report and print every 100
while(vo.hasNext())
curRow++;
if (curRow % 100 == 0 )
System.out.println(curRow + "");
--- End Servlet Snippet ---
--- Begin RdmUserHandlerImpl Snippet ---
public ViewObject getReportView2(String tableName, Object sessionId) throws Exception {
System.out.println("IN GET REPORT VIEW");
ApplicationModule appMod = (ApplicationModule)getConnection("classpath...resource.MyUser", sessionId);
// First see if we already created the view definition
ViewObject vo = appMod.findViewObject(tableName);
// If it was already created then refresh it, else lets try to create it
if(vo != null) {
System.out.println("found existing view");
vo.reset();
else {
System.out.println("view not found, making new view");
String query="SELECT * FROM " + tableName;
System.out.println("QUERY = " + query);
vo = appMod.createViewObjectFromQueryStmt(tableName, query);
// max fetch returns -1
System.out.println("MAX Fetch Size = " + vo.getMaxFetchSize());
return vo;
--- End RdmUserHandlerImpl Snippet ---
Please reply asap! Deadline is coming fast!
-MattMatt,
I think that you are right, the temporary tables created by BC4J are the reason for making it slow after a certain number of records. One of Steve Muench's articles includes the text:
One of the most frequent performance-related questions we get on the Oracle Technet discussion forum is a question like, "After I query about a 1000 rows in a view object, my application gets very, very slow. What's happening?"
It explains how you can turn off this feature, see the full article at http://www.oracle.com/technology/products/jdev/tips/muench/voperftips/index.html.
The following article gives a lot of helpful information about the temporary tables:
http://www.oracle.com/technology/products/jdev/htdocs/bc4j/bc4j_temp_tables.html
The next article gives general tips for performance tuning of BC4J:
http://www.oracle.com/technology/products/jdev/howtos/10g/adfbc_perf_and_tuning.html
Hope this helps,
Sandra Muller
JHeadstart Team -
Result Set fetch agonisingly slow
I am having sporadic trouble retrieving data from a ResultSet. I do not know how to tell if it is an Oracle problem or a JDBC problem.
In a while( results.next() ) loop, for some result sets it pauses for several seconds after every 10 iterations. This usually causes a webserver time-out and the results never get to the browser. It is NOT volume related, as some LARGER result sets from almost identical queries (i.e. with just one value in the where clause changed) run fine. We are using Oracle 8i, and the "problem" query always runs fine in SQLPlus (i.e. less than ten seconds for the execution and display of ~700 rows).
some relevant evidence:
a) Usually the PreparedStatement.execute() itself is pretty quick - just a few seconds at worst
b) All result sets from this query pause every 10 iterations, but most pause for just a fraction of a second
c) With a certain value in the where clause, the pauses are 4-30 seconds, which, even when only ~700 rows are returned, results in a response time of several minutes.
d) The pauses are in the results.next() statement itself (I have output timestamps at the very beginning and the very end of the loop to show this).
e) the query is a join of six tables
f) the part of the where clause that changes is: AND FULFILLER.NAME IN (...) , where the IN clause can contain single or multiple names (but I am using a single value in the "problem" query)
g) The FULFILLER.NAME column IS an indexed field, and that index IS being used (according to "EXPLAIN PLAN") in both the fast queries and the slow queries.
What confuses me (amongst several things) is this: I would have thought that the values in the where clause would only affect the creation of the ResultSet, and not the reading of that result set. Am I wrong? Any ideas anyone?
Thanks,
Martin Reynolds (renozu)I am having sporadic trouble retrieving data from a
ResultSet. I do not know how to tell if it is an
Oracle problem or a JDBC problem.
In a while( results.next() ) loop, for some
result sets it pauses for several seconds after every
10 iterations. This usually causes a webserver
time-out and the results never get to the browser. It
is NOT volume related, as some LARGER result sets from
almost identical queries (i.e. with just one value in
the where clause changed) run fine. We are using
Oracle 8i, and the "problem" query always runs fine in
SQLPlus (i.e. less than ten seconds for the execution
and display of ~700 rows).
some relevant evidence:
a) Usually the PreparedStatement.execute() itself is
pretty quick - just a few seconds at worst
b) All result sets from this query pause every
10 iterations, but most pause for just a fraction of a
second
c) With a certain value in the where clause, the
pauses are 4-30 seconds, which, even when only ~700
rows are returned, results in a response time of
several minutes.
d) The pauses are in the results.next() statement
itself (I have output timestamps at the very beginning
and the very end of the loop to show this).
e) the query is a join of six tables
f) the part of the where clause that changes is:
AND FULFILLER.NAME IN (...) , where the IN
clause can contain single or multiple names (but I am
using a single value in the "problem" query)
g) The FULFILLER.NAME column IS an indexed field, and
that index IS being used (according to "EXPLAIN PLAN")
in both the fast queries and the slow queries.
What confuses me (amongst several things) is this: I
would have thought that the values in the where clause
would only affect the creation of the
ResultSet, and not the reading of that result
set. Am I wrong? Any ideas anyone?
this honestly doesn't HAVE to be the case... depending on the cursor.
i think if one has a forward only cursor the database could figure it out as it scans along the table. it should be fater in fact because if it does like this you only do one table scan and not two. this theory seems to fall apart when you say it is using the index BUT if I was writing a database and you had a forward only cursor AND the distribution of keys in the index indicated that there were many rows that would match your query I might ignore the index and do it as described.
so call me crazy but here is my suggestion...
if the cursor you are using is a forward only cursor then try a scrollable cursor.
if it is already a scrollable cursor or changing it didn't help then try this...
rs.last();
rs.beforeFirst();
// now process normally using next()i would think that this would force the database to find all the rows.... so it should help.
also the server timeout issue will sort of need to be addressed also if the query still takes a long time to run...
Thanks,
Martin Reynolds (renozu) -
JDBC-ODBC Bridge to SPSS data files - Result Set Type is not supported
Hello,
As mentioned in the subject I am trying to read SPSS data files using the SPSS 32-Bit data driver, ODBC and the JDBC-ODBC Bridge.
Using this SPSS Driver I manged to read the data directly into an MS-SQL Server using:
SELECT [...] FROM
OPENROWSET(''MSDASQL.1'',''DRIVER={SPSS 32-BIT Data Driver (*.sav)};DBQ=' SomePathWhereTheFilesAre';SERVER=NotTheServer'', ''SELECT 'SomeSPSSColumn' FROM "'SomeSPSSFileNameWithoutExt'"'') AS a
This works fine!
Using Access and an ODBC System DNS works for IMPORTING but NOT for LINKING.
It is even possible to read the data using the very slow SPSS API.
However, when it comes to JDBC-ODBC the below code does only work in part. The driver is loaded successfully, but when it comes to transferring data into the resultset object the error
SQLState: null
Result Set Type is not supported
Vendor: 0
occurs.
The official answer from SPSS is to use .Net or to use their implementation with Python in their new version 14.0. But this is obviously not an option when you want to use only Java.
Does anybody have experience with SPSS and JDBC-ODBC??? I have tried the possible ResultSet Types, which I took from:
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/ad/rjvdsprp.htm
and none of them worked.
Thank you in advance for your ideas and input & stay happy!
Here the code without all the rest of the class arround it:
// Module: SimpleSelect.java
// Description: Test program for ODBC API interface. This java application
// will connect to a JDBC driver, issue a select statement
// and display all result columns and rows
// Product: JDBC to ODBC Bridge
// Author: Karl Moss
// Date: February, 1996
// Copyright: 1990-1996 INTERSOLV, Inc.
// This software contains confidential and proprietary
// information of INTERSOLV, Inc.
public static void main1() {
String url = "jdbc:odbc:SomeSystemDNS";
String query = "SELECT SomeSPSSColumn FROM 'SomeSPSSFileName'";
try {
// Load the jdbc-odbc bridge driver
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
DriverManager.setLogStream(System.out);
// Attempt to connect to a driver. Each one
// of the registered drivers will be loaded until
// one is found that can process this URL
Connection con = DriverManager.getConnection (url);
// If we were unable to connect, an exception
// would have been thrown. So, if we get here,
// we are successfully connected to the URL
// Check for, and display and warnings generated
// by the connect.
checkForWarning (con.getWarnings ());
// Get the DatabaseMetaData object and display
// some information about the connection
DatabaseMetaData dma = con.getMetaData ();
System.out.println("\nConnected to " + dma.getURL());
System.out.println("Driver " +
dma.getDriverName());
System.out.println("Version " +
dma.getDriverVersion());
System.out.println("");
// Create a Statement object so we can submit
// SQL statements to the driver
Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY ,ResultSet.CONCUR_READ_ONLY);
// Submit a query, creating a ResultSet object
ResultSet rs = stmt.executeQuery (query);
// Display all columns and rows from the result set
dispResultSet (rs);
// Close the result set
rs.close();
// Close the statement
stmt.close();
// Close the connection
con.close();
}Thank you for your reply StuDerby!
Actually the above script was before, as you suggested, leaving the ResultSetTeype default. This did not work...
I am getting gray hair with SPSS - in terms of connectivity and "integratebility" none of their solutions offered is sufficient from my point of view.
Variable definitions can only be read by the slow API, data can only be read by Python or Microsoft Products... and if you want to combine both you are in big trouble. I can only assume that this is a company strategy to sell their Dimensions Platform to companies versus having companies developping their applications according to business needs.
Thanks again for any furthur suggestions and I hope, that some SPSS Developper will see this post!
Cheers!! -
How to get the result set in batches
I have a query which results into large data. This data i want to display in a group of 20. After every 20 records i want to add header and footer to it.
Is it possible to get the result set data into batch of 20 ? means can i specify start and end index of query ?
regards
ManishaWhat I am saying is that a big query with lots of
joins will probably be slow, and as such would be a
ripe candidate for batching the responses, if it were
not possible to speed/optimize it. Batching is nice
to look at for the user, but is not a solution for
performance problems. In essence it is irrelevant
that it adds a little performance deficit, as it
appears to be running a lot quicker, and gives more
feedback to the user.Then let me say it again....
- "Join" is a term that applies to a method of doing queries in the database....
- Query 1 which uses a join and returns 15 rows
- Query 2 which does not use a join and returns 1500 rows.
Given the above then Query 1 will provide better overall performance for the system than Query 2 in a properly configured database.
If it doesn't then the database is not set up correctly.
And again this will be irrespective of whether the query is scrollable or not. -
How to get the number of records of a streaming result set
Hi guys.
So if it wasn't a streaming result set, I would have done this:
{noformat}myResultSet<code class="jive-code jive-java">.last();
{color:navy}*int*{color} numResults = </code>myResultSet<code class="jive-code jive-java">.getRow();
</code>myResultSet<code class="jive-code jive-java">.beforeFirst();
</code>{noformat}
but being a streaming result set, beforeFirst() throws an exception...
So how do you get the number of records in that result set? I wanna avoid an extra count(*) query, so I would appreciate other solutions than that.JoachimSauer wrote:
vanwil wrote:
you see, for now I just use a count(*) query to get the number of records, but that's adding a lot of extra waiting time...Iterating over the result twice will surely be slower then doing the count(*).great! so what I got now is actually the fastest way there is... awesome...
If you get an exception, then you surely have a stack trace. That should tell you what happens, or at least where.com.mysql.jdbc.MysqlIO.checkForOutstandingStreamingData(MysqlIO.java:2066)
Why do you need to know the number of elements beforehand, anyway?I need to know the number of elements because the incoming data goes into a table. Now of course, I could use ArrayList<String[]> or something, but wouldn't that require more memory resources than Object[][] ?
No one can tell you that, at least not without more information (say, the stack trace for example).Here's the exception message:
java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@10c0ef2 is still active. Only one streaming result set may be open and in use per-connection. Ensure that you have called .close() on any active result sets before attempting more queries. -
Newbie: compare 2 result sets in procedure
I have two queries. One selects 5 values (all number datatypes), the second query selects 2 values (both number datatypes).
If a value from query 2 exists in the resultset of query 1 - go make table updates using the second value in the select statment of query 2. If there is not a match, update a table with values from query 1.
Currently, I have two cursor for loops, which are nested. This works but of course is horribly slow. What is a better way to process this data?
The number of rows varies between the two resultsets.
Oracle 11.2.0.3.2Query one sample resultset (normally approximately 25K rows returned):
1701553486214000 104574 6200 9888 55
1701553486102000 104573 6445 9817 54
1701553486046000 104572 6072 10740 46
1701553485230000 104567 5800 10811 47
1701553485153000 104566 6475 10172 42
1701553485055000 104565 5873 10882 48
1701553485033000 104564 6420 9462 49
1701553484067000 104559 6008 10030 41
Query two sample result set (this resultset will always be a sub-set of query one - based on the second column value)
104566 1701524076315000
23321 1701524076315000
23279 1701524077350000
23278 1701524077350000
104574 1701524109347000
23320 1701524109347000
23317 1701524113720000
23318 1701524113720000
23287 1701524118000000
83219 1701524118000000
104601 1701524118000000
23327 1701524118000000
83059 1701524118000000
23329 1701524128827000
if the value of colum 1 (c1) in query 2 (q2) exists in colum 2 (q2) of query 1 (q1)
then
update table
set value = sysdate-c2;
else
update table
set value = sysdate;
Does that help clarify? -
Sql Developer 3.1 - Exporting a result set in xls generates and empty file
Ever since upgrading to the Production version SQL Developer 3.1 (3.1.07) it appears that there is an issue when attempting to export a result set as a .xls format.
If I attempt to export in .xls format, the exported file is an empty file (i,e no output). When I change the export type to txt, csv or xlsx the results are exported as expected.
This appears to be a bug introduced in the Production version as I was successfully able to perform these tasks on the various 3.1 EA releases.
Am I alone in this, have I misconfigured something or is this a bug?I keep having problems exporting to XLSX - mostly in cases where the data is voluminous and the format would be preferable over plain XLS as it does not have the 65krows limit ;-{ The data is read to the data grid (sometimes fast, sometimes much slower and "in chunks"), then the "task progress" won't move anymore, and the export file remains empty; If I cancel the task, trying to export again results in a message stating that sqldeveloper still has the output file locked.
-
BW Web Report Issue - Result set too large
Hi,
When I execute a BEx Query on Web I am getting “Result set too large ; data retrieval restricted by configuration (maximum = 500000 cells)”.
Following to my search in SDN I understood we can remove this restriction either across the BW system globally or for a specific query at WAD template.
In my 7x Web template I am trying to increase default max no of rows parameters, As per the below inputs from SAP Note: 1127156.
But I can’t find parameter “Size Restriction for Result Sets” for any of the web items (Analysis/Web Template properties/Data Provider properties)….in the WAD Web template
Please advise where/how can I locate the properites
Instructions provided in SAP Note…
The following steps describe how to change the "safety belt" for Query Views:
1. Use the context menu Properties / Data Provider in a BEx Web Application to maintain the "safety belt" for a Query View.
2. Choose the register "Size Restriction for Result Sets".
3. Choose an entry from the dropdown box to specify the maximum number of cells for the result set.
The following values are available:
o Maximum Number
o Default Number
o Custom-Defined Number
Behind "Maximum Number" and "Default Number" you can find the current numbers defined in the customizing table RSADMIN (see below).
4. Save the Query View and use it in another Web Template.
Thanks in advanceHi Yasemin,
Thanks for all help...i was off couple of days.
To activate it I can suggest to create a dummy template, add your query in it, add a menu bar component add an action to save the query view. Then you run the template and change the size restriction for result set then you can save it by the menu.
Can you please elaborate on the solution provided,I created dummy template with analysis and Menu bar item...i couldn't able to configure menu bar item...
Thanks in advance -
How can I use ONE Text search iView to event/affect mutliple Result Sets?
hello everyone,
i have a special situation in which i have 6 flat tables in my repository which all have a common field called Location ID (which is a lookup flat to the Locations table).
i am trying to build a page with a free-form text search iView on Table #1 (search field = Location ID). when I execute the search, the result set for Table #1 is properly updated, but how do I also get Result Set iViews for Tables #2-6 to also react to the event from Text Search for Table #1 so that they are updated?
i don't want to have to build 6 different text search iViews (one for each table). i just want to use ONE text search iView for all the different result set tables. but, in the documentation and iView properties, the text search iView doesn't have any eventing.
if you have any suggestions, please help.
many thanks in advance,
mmhello Donna,
that should not be a problem, since you are detailw with result sets and detail iviews because custom eventing can be defined for those iviews.
Yes, it says "no records" found because an active search and record selection havent' been performed for it (only your main table does).
So, yes, define a custom event, and pass the appropriate parameters and you should be fine.
Creating a custom event between a Result Set iView and an Item Details iView is easy and works. I have done it.
See page 35 of the Portal Content Development Guide for a step-by-step example, which is what I used.
For my particular situation, the problem I'm having is that I want the Search Text iView's event (i.e., when the Submit button is pressed) to be published to multiple iViews, all with different tables. Those tables all share some common fields, which is what the Search iView has, so I'd like to pass the search critera to all of the iViews.
-mm -
Access Subform - Can the Subforms Source Object be defined by an SQL SP result set?
Hi Guys,
I can't clearly answer this question with a yes or no.
I have an Access Sub Form that I am populating with a record set from a Store Procedure. Fairly early on I discovered that for this to work correctly the Source Object for the Sub Form Control must be set first, and most examples (including a working version
of my own) achieve this by defining an Access Query and setting the Source Object to this.
What I would really like to do is define the Source Object using the results of a SQL Store Procedure using ONLY code within VBA.
Now before anyone starts providing alternatives "why don't you just..." I'm noting now that I have a semi complex solution that makes most non-VBA based approaches ineffective. While it does work at present with an Access Query I'm needing
to make the result set more dynamic meaning in future I will not know how many columns will be returned or the name of them, only the SP will have this information.
Thanks in advance!Well after much trial and error I've got something which does what I want, although I'm not thrilled that I couldn't do this via my existing ADODB connections, in any case example provided below;
Dim db As DAO.Database
Dim qdf As New DAO.QueryDef
Set db = CurrentDb()
'qryMyTest refers to a dummy Access query (non pass through).
With db.QueryDefs("qryMyTest")
.Connect = CurrentDb.TableDefs("tblSomeTestSQLTable").Connect
.SQL = "exec sp_MyTestSP"
Me.subfrmTest1.SourceObject = "Query.qryMyTest"
End With
Set qdf = Nothing
I've also marked your response Alphonse as an answer as it lead me onto the right path. -
SCROLL_SENSITIVE result set can't see the data inserted.
hi all ,
I am trying to display all the latest data available in the table through SCROLL_SENSITIVE and UPDATABLE result set after inserting a new record in the table.
But the result set obtained after executing the query initially is not able to see the newly inserted record in the table and hence same result is getting printed out in both the cases.
Can u explain me what's happening in this case ?? And how can i get the updated record also without executing the statement query twice to get the latest result set.
My full code is given below.
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Misc3 {
public static void main(String[] args) {
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
int empid;
String lname;
String fname;
int deptno;
int mngrid;
con = JDBCUtil.getOracleConnection();
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
String query = "select employee_id , last_name , first_name , department_number , manager_id from employees ";
rs = stmt.executeQuery(query);
System.out.println("Before inserting the new record.....");
while (rs.next()) {
empid = rs.getInt(1);
lname = rs.getString(2);
fname = rs.getString(3);
deptno = rs.getInt(4);
mngrid = rs.getInt(5);
System.out.println(empid + "\t" + lname + "\t" + fname + "\t" + deptno + "\t" + mngrid);
System.out.println("Going to insert the new record.....");
rs.moveToInsertRow();
rs.updateInt(1, 10);
rs.updateString(2, "Clark");
rs.updateString(3, "John");
rs.updateInt(4, 2);
rs.updateInt(5, 2);
rs.insertRow();
System.out.println("New record inserted successfully.....");
System.out.println("After inserting the new record.....");
rs.beforeFirst();
while (rs.next()) {
empid = rs.getInt(1);
lname = rs.getString(2);
fname = rs.getString(3);
deptno = rs.getInt(4);
mngrid = rs.getInt(5);
System.out.println(empid + "\t" + lname + "\t" + fname + "\t" + deptno + "\t" + mngrid);
} catch (SQLException ex) {
System.out.println("error code : " + ex.getErrorCode());
System.out.println("error message : " + ex.getMessage());
} finally {
JDBCUtil.cleanUp(con, stmt);
*** JDBCUtil Class ****
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class JDBCUtil {
public static Connection getOracleConnection(){
Connection con = null;
try{
// Load the driver
Class.forName("oracle.jdbc.driver.OracleDriver");
//Establish Connection
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","ex","ex");
}catch(Exception ex){
ex.printStackTrace();
return con;
public static void cleanUp (Connection con , Statement stmt){
// Release the resource
try{
if(con != null){
con.close();
if(stmt != null){
stmt.close();
}catch(Exception ex){
ex.printStackTrace();
Edited by: user12848632 on Aug 13, 2012 2:06 PM>
Can u explain me what's happening in this case ?? And how can i get the updated record also without executing the statement query twice to get the latest result set.
>
Sure - but you could have answered your own question if you had read the doc link I gave you in your other thread and next time you post code use \ tags on the lines before and after the code - see the FAQ for info
17076 : Invalid operation for read only resultset
{quote}
•Internal INSERT operations are never visible, regardless of the result set type.
{quote}
See •Seeing Database Changes Made Internally and Externally in the JDBC Dev doc I pointed you to
http://docs.oracle.com/cd/B28359_01/java.111/b31224/resltset.htm#i1024720
Did you notice the words 'never visible'? You won't see them as part of the result set unless you requery. -
How to Create a new column from two different result sets
How to Create a new column from two different result sets, both the result set uses the different date dimensions.
i got solutions for this is apply filters in column formula it self, based on the requirement.
-
How do I create an Event Handler for an Execute SQL Task in SSIS if its result set is empty
So the precedence on my entire package executing is based on my first SELECT of my Table and an updatable column. If that SELECT results in an empty result set, how do I create an Event Handler to handle an empty result set?
A Newbie to SSIS.
I appreciate your review and am hopeful for a reply.
PSULionRPDepends upon what you want to do in the eventhandler. this is what you can do
Store the result set from the Select to a user variable.
Pass this user variable to a Script task.
In the Script task do whatever you want to do including failing the package this can be done by failing the script task, which in turns fails the package. something like
Dts.TaskResult = Dts.Results.Failure
Abhinav http://bishtabhinav.wordpress.com/
Maybe you are looking for
-
ERROR(web elements)- A string can be at most 65534 characters long
Hello I have a 2 level dynamic cascading prompt in crystal reports. 1st level distinct count of values->223 but second level distinct count of values->30,133. I am able to track these values in the sub report. while passing the values from subreport
-
Hello. I have wi-fi bridge between two routers TP-LINK WR841ND. The name of this technology - WDS. HP Laser JET 1536 dnf MFP connect to one of this routers (copper). Second device (my NETBOOK) connect to second router (WiFi). I have good communicatio
-
Reader 10.1.1 Protected Mode
Hello I am deploying Reader 10.1.1, but on some computers protected mode is blocking PDF files from being opened from a network drive. Is it possible to configure protected mode for a safe domain. The solutions I have so far, disable protected mode,
-
Need logic for af:inputNumberSlider
Hello, Does anyone have any code samples that codes logic for <af:inputNumberSlider> component? If yes, would you mind pasting on this forum thread? Thanks a million for the help. Regards, Ruchir
-
Sending a large amount of data over a post
Hi. I'm trying to send a large amount of text (about 400,000 characters) with a post to a servlet running in Tomcat. For debugging my servlet just writes the data to standard out and a text file. The problem is, I get about 2048 characters printed co