Cauld i open a result set and open another before ending the first?
in this code i have an opened ResultSet and i want another one to b opened durring the action of the first ..............can i do such a thing without opening a new connection? :_*<br /</strong> <table width="100%" border="1">
<%
while(boolVar3)
%> <tr>
<td><%=res3.getString("patient_id")%></td>
<td><%=res3.getString("patient_name")%></td>
<td><%=res3.getString("patient_address")%></td>
<td><%=res3.getString("patient_tel")%></td>
<td><%=res3.getString("patient_dob")%></td>
<td><%=res3.getString("patient_email")%> </td>
<%
user_id= res3.getInt("username_id");
sataus_id=res3.getInt("patient_status_id");
} res9=state.executeQuery("select * from patient_data join username on patient_data.username_id=username.username_id where patient_data.username_id='"+user_id+"'");
if(res9.next())
%>
<td><%=res9.getString("username")%></td>
<td><%=res9.getString("password")%>
<%}
res10=state.executeQuery("select * from patient_data join status_patient on patient_data.patient_status_id=status_patient.status_id where patient_data.patient_status_id='"+sataus_id+"'");
if(res10.next())
{%></td><td>
<%=res10.getString("status_name")%></td></tr><%}} %>
</table>
yes u r right they r collection.
try this java code pattern and reply.
public class classname{
ArrayList test1 = new ArrayList();
ArrayList test2 = new ArrayList();
String rsValue = "";
test1.clear();
ResultSet rs1 = st.executeQuery('....");
while(rs1.next())
rsValue = rs1.getString(1);
test1.add(rsValue);
ResultSet rs2 = st.executeQuery('....");
while(rs2.next())
rsValue = rs2.getString(1);
test2.add(rsValue);
}//end of class
You shud know abt collections also mainly util package that helps in more ways try learning that
Similar Messages
-
How can I use a Lookup task to lookup from my SQL Result set and have a join
So in my Control Flow, I have an Execute SQL Task which gets my Table result set. I then have a Foreach Loop Container that iterates through the result set and a Data Flow. The first task in the Data Flow is an OLE DB Source SQL Command that retrieves data
columns associated with my result set. I then do a Derived Column so I can SUBSTRING from one of my data columns and now I want to perform a Lookup to my Application Database.
How do I code my Lookup task to utilize my SQL Result set variable and match on it? I cannot use the GUI for the Lookup task as my Lookup has to have some JOINS in it.
Thanks for your review and am hopeful for a reply.Can you expand on that? I'm sorry but I am new and a novice to the SSIS world and I want to do this as best I can and as efficiently as I can. Are you saying that Rajen's way suggested above is the way to go?
A little background....external data from a 3rd party client. I'v staged that external data to a SQL Server staging table. I have to try and match that data up to our database using SSN, DOB, and Gender...and if I can't match that way then I have to try
and match by Name. I need to make sure that there is only one and only one account for that match. If I cannot match and match one and only one, then I'll create rows on a DataAnomaly Table. If I do match, then I have to check and make sure that there is only
one and only one Member span for that match. Similarly handle the data anomaly and then check and make sure there is a "Diabetes" claim and similarly handle the DataAnomaly accordingly.
That's where I'm at. Sooooo are you saying to use Rajen's suggestion? I don't think I can do that because I need multiple SQL tasks and I cannot connect multiple OLE DB Source tasks.
Any help and suggestions are greatly appreciated.
Thanks. -
Went to Help. But the instructions didn't work
clicking the iPhoto icon with the Option and Command keys opened iPhoto but not the First Aid as promisedGive this a try:
1 -be sure to have a current backup of the iPhoto library.
2 - download and launch http://www.macchampion.com/arbysoft/BatChmod.
3 - click on the File button, locate and select your iPhoto Library.
4 - check the Unlock and Apply to enclosed checkboxes.
5 - make no changes to the other checkboxes
6 - click on the Apply button.
OT -
Why to need close the result set and statement
why to need close the result set and statement
It's best to explicitly close every ResultSet, Statement, and Connection in the narrowest scope possible.
These should be closed in a finally block.
Since each close() method throws SQLException, each one should be in an individual try/catch block to ensure that a failure to close one won't ruin the chances for all the others.
You can capture this in one nice utility class, like this:
package db;
import java.sql.*;
import java.util.ArrayList;
import java.util.Map;
import java.util.LinkedHashMap;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
* Created by IntelliJ IDEA.
* User: MD87020
* Date: Feb 16, 2005
* Time: 8:42:19 PM
* To change this template use File | Settings | File Templates.
public class DatabaseUtils
* Logger for DatabaseUtils
private static final Log logger = LogFactory.getLog(DatabaseUtils.class);
/** Private default ctor to prevent subclassing and instantiation */
private DatabaseUtils() {}
* Close a connection
* @param connection to close
public static void close(Connection connection)
try
if ((connection != null) && !connection.isClosed())
connection.close();
catch (SQLException e)
logger.error("Could not close connection", e);
* Close a statement
* @param statement to close
public static void close(Statement statement)
try
if (statement != null)
statement.close();
catch (SQLException e)
logger.error("Could not close statement", e);
* Close a result set
* @param rs to close
public static void close(ResultSet rs)
try
if (rs != null)
rs.close();
catch (SQLException e)
logger.error("Could not close result set", e);
* Close both a connection and statement
* @param connection to close
* @param statement to close
public static void close(Connection connection, Statement statement)
close(statement);
close(connection);
* Close a connection, statement, and result set
* @param connection to close
* @param statement to close
* @param rs to close
public static void close(Connection connection,
Statement statement,
ResultSet rs)
close(rs);
close(statement);
close(connection);
* Helper method that maps a ResultSet into a map of columns
* @param rs ResultSet
* @return map of lists, one per column, with column name as the key
* @throws SQLException if the connection fails
public static final Map toMap(ResultSet rs) throws SQLException
List wantedColumnNames = getColumnNames(rs);
return toMap(rs, wantedColumnNames);
* Helper method that maps a ResultSet into a map of column lists
* @param rs ResultSet
* @param wantedColumnNames of columns names to include in the result map
* @return map of lists, one per column, with column name as the key
* @throws SQLException if the connection fails
public static final Map toMap(ResultSet rs, List wantedColumnNames)
throws SQLException
// Set up the map of columns
int numWantedColumns = wantedColumnNames.size();
Map columns = new LinkedHashMap(numWantedColumns);
for (int i = 0; i < numWantedColumns; ++i)
List columnValues = new ArrayList();
columns.put(wantedColumnNames.get(i), columnValues);
while (rs.next())
for (int i = 0; i < numWantedColumns; ++i)
String columnName = (String)wantedColumnNames.get(i);
Object value = rs.getObject(columnName);
List columnValues = (List)columns.get(columnName);
columnValues.add(value);
columns.put(columnName, columnValues);
return columns;
* Helper method that converts a ResultSet into a list of maps, one per row
* @param rs ResultSet
* @return list of maps, one per row, with column name as the key
* @throws SQLException if the connection fails
public static final List toList(ResultSet rs) throws SQLException
List wantedColumnNames = getColumnNames(rs);
return toList(rs, wantedColumnNames);
* Helper method that maps a ResultSet into a list of maps, one per row
* @param rs ResultSet
* @param wantedColumnNames of columns names to include in the result map
* @return list of maps, one per column row, with column names as keys
* @throws SQLException if the connection fails
public static final List toList(ResultSet rs, List wantedColumnNames)
throws SQLException
List rows = new ArrayList();
int numWantedColumns = wantedColumnNames.size();
while (rs.next())
Map row = new LinkedHashMap();
for (int i = 0; i < numWantedColumns; ++i)
String columnName = (String)wantedColumnNames.get(i);
Object value = rs.getObject(columnName);
row.put(columnName, value);
rows.add(row);
return rows;
* Return all column names as a list of strings
* @param rs query result set
* @return list of column name strings
* @throws SQLException if the query fails
public static final List getColumnNames(ResultSet rs) throws SQLException
ResultSetMetaData meta = rs.getMetaData();
int numColumns = meta.getColumnCount();
List columnNames = new ArrayList(numColumns);
for (int i = 1; i <= numColumns; ++i)
columnNames.add(meta.getColumnName(i));
return columnNames;
}Anybody who lets the GC or timeouts or sheer luck handle their resource recovery for them is a hack and gets what they deserve.
Do a search on problems with Oracle cursors being exhausted and learn what the root cause is. That should convince you.
scsi-boy is 100% correct.
% -
Help with streaming result sets and prepared statements
hi all
I create a callable statement that is capable of streaming.
statement = myConn2.prepareCall("{call graphProc(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}",java.sql.ResultSet.TYPE_FORWARD_ONLY,
java.sql.ResultSet.CONCUR_READ_ONLY);
statementOne.setFetchSize(Integer.MIN_VALUE);
the class that contains the query is instantiated 6 times the first class streams the results beautifully and then when the second
rs = DatabaseConnect.statementOne.executeQuery();
is executed I get the following error
java.sql.SQLException: Can not use streaming results with multiple result statements
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1370)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1688)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3031)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:943)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1049)
at com.mysql.jdbc.CallableStatement.executeQuery(CallableStatement.java:589)
the 6 instances are not threaded and the result set is closed before the next query executes is there a solution to this problem it would be greatly appreciated
thanks a lot
BrianDatabase resources should have the narrowed scope
possible. I don't think it's a good idea to use a
ResultSet in a UI to generate a graph. Load the data
into an object or data structure inside the method
that's doing the query and close the ResultSet in a
finally block. Use the data structure to generate
the graph.
It's an example of MVC and layering.
Ok that is my bad for not elaborating on the finer points sorry, the results are not directly streamed into the graphs from the result set. and are processed in another object and then plotted from there.
with regards to your statement in the beginning I would like to ask if you think it at least a viable option to create six connections. with that said would you be able to give estimated users using the six connections under full usage.
just a few thoughts that I want to
bounce off you if you don't mind. Closing the
statement would defeat the object of of having a
callable statement How so? I don't agree with that.
%again I apologise I assumed that since callable statements inherit from prepared statements that they would have the pre compiled sql statement functionality of prepared statements,well If you consider in the example I'm about to give maybe you will see my point at least with regards to this.
The statement that I create uses a connection and is created statically at the start of the program, every time I make a call the same statement and thus connection is used, creating a new connection each time takes up time and resources. and as you know every second counts
thanks for your thoughts
Brian. -
Cannot save opened tabs before closing the browser
Cannot save opened tabs before closing the browser. I do not know if there is such a feature (should be), and how to activate it.
It was very useful with previous version.One change in Firefox 4 is to by default stop Firefox displaying the warning message, but it can be turned back on by changing some preferences.
# Type '''about:config''' into the location bar and press enter
# Accept the warning message that appears, you will be taken to a list of preferences
# Locate the preference '''browser.tabs.warnOnClose''', if its value is set to '''false''', double-click on it to change its value to '''true'''
# Repeat this for these 3 preferences '''browser.warnOnQuit''', '''browser.warnOnRestart''' and '''browser.showQuitWarning'''
If you always open the last set of tabs an alternative approach is this:
# Click the orange Firefox button, then select options to open the options window
# Go to the General panel
# Change the setting "When Firefox starts" to "Show my windows and tabs from last time" -
HOW TO STOP you are opening this program for the first time
I continue to get the warning "you are opening this program for the first time". I don't want that warning to ever appear again for any program. How to permanently get this warning to never again appear?
Best regards,
Steve Schulte
Wednesday 21 November 2012Thomas,
The reason I don't want these warnings (especially for programs that I have had on my Mac for years!) is because I now use ecamm's "Printopia" to send items from my iPad3 running iOS 6.0.1 to my MacBook Pro-13 (mid-2010) running Mountain Lion 10.8.2 -- and in order to do this:
1. Both my iPad and Mac have to be on the same WiFi network.
2. The Mac has to be awake, cannot be in the "sleep" mode
OK but in order to wake my Mac, I've found that using the app "Remote" on my iPad to open iTunes AND PLAY A SONG will "waken" my Mac*.
So now, for example, I send a .jpg file to my Mac. I have it set so that GraphicConverter opens when a .jpg file is to be opened. OK but if this warning appears (and even though I have had GraphicConverter on the Mac since the beginning of time…) I sometimes (like today) get this warning. Of course I am not at my Mac and yet when I eventually go to my Mac-- there is that dialog box sitting there and until I click OK the photo doesn't open (and on my iPad I don't get a confirmation that it has been sent, because it hasn't until I click OK on the Mac).
This could happen for other types of files, too - text files or Word documents etc.
It seems to happen when I UPDATE a program, like when GC went from 8.3 to 8.3.1 for example.
Thanks for any additional comments.
*Perhaps there is a better / faster / easier way to "waken" my Mac from my iPad? This is the only way I have found so far… -
I can't open an update for Acrobat 9 pro I get asked to open another prog from the suite but when Io
I can't open an update for Acrobat 9 pro I get asked to open another prog from the suite but when I do Acrobat just shuts down,help !!
And I can't get back to the older version of AcrobatSee this User Tip by turingtest2
https://discussions.apple.com/docs/DOC-6562
JimmieJag wrote:
2. If I reinstall it, will I lose my store credit and non-iTunes songs?
Nothing should be lost... However... it is both Prudent and Recommended that a backup should have been created and maintained. -
Why can't I open another tab in the current window anymore?
I have not had an issue with this problem until today. I have had my laptop since May 2010 and I have been using firefox the whole time. Today, my roommate used my computer, but used internet explorer. Since then, I have not been able to open another tab on the current page.
Perfect solution. The resolution was not letting me get past the user agreement and into the iPod settings.
Really appreciate your taking time to respond. Thank you! -
WHY DOES IT ACT LIKE I AM OPENING ITUNES UP FOR THE FIRST TIME
WHY DOES IT ACT LIKE I AM OPENING ITUNES UP FOR THE FIRST TIME
dewin1or wrote:
I want to extend the length of the song by repeating the first 28 measures.
split the region at the 28th measure
http://www.bulletsandbones.com/GB/GBFAQ.html#split
(Let the page FULLY load. The link to your answer is at the top of your screen)
then select only the first region and option-drag it to the end of the song -
"you are opening application "xyz" for the first time are you sure you want
When working in Tiger or Panther if I click on a document eg: word, illustrator, photoshop, indesign. and the application that is supposed to open this document is not open already. You get a warning message. that says "you are opening application "xyz" for the first time are you sure you want to open it. " Even though this is not the first time the application has been launched. However if you launch the application from the applications folder or from the dock the warning does not appear.
How do you disable this warning or at least correctly inform the OS that the application has been opened before.application
This happens from clean installs and those that have their launch services database cleared the link from document to application survives a logout but not a restart. I know it is a security feature and not a bug but it would be nice to know where this cache/.plist is and why it is suffering from amnesia.
Textedit does not exhibit this behavior across installs but any other app does I get the warning whether it is a user with a lMichael,
This could be related to the Side effects of System cache cleaning.
;~) -
When using private browsing to view image results in Safari 5.1.3, only the first two rows of results are visible, the following four or so rows display greyed out place holders, the remainder of the results page is blank, and the safe search button is inoperable. When I turn off private browsing and refresh the page, everything works again.
Anyone else having this problem?I have got the same behaviour after the last Safari Update to 5.1.3. It seems that Safari now handles some scripts in a new way. If you debug the Google Website, you will see, that there is some Javascript Error, that seems to prevent to write into local cache. After some searching I wasn't able to finde a solution for this problem, other then disabling Javascript while private browsing to prevent the script loading. You then are able to use Google with the old layout. The option to disable JavaScript can be found in the Menu "Developer", wich has to be enabled in Safari in the options first.
In my opinion this is a bug that is now occuring, because Apple changed something in private browsing and that has to be fixed by Google now, to run again. Or we will have to wait for 5.1.4, as you can read online Apple will change and bugfix the javascript engine in that version, perhaps this fixes the problem as well. I hope so!
If anyone is in the developer program perhaps you could test this with the beta of 5.1.4 and tell us if it works. -
I'm setting up my Time Capsule for the first time and can't get an internet connection via ethernet cord
So new AC model TC??
What modem is it? Pure cable modem .. did you power cycle the modem ( OFF for at least 30min..)??
This is essential to lose the old setup and start afresh.
How have you setup the TC?
Did you try just bridge to existing router? If it doesn't get an IP and you just bought it, possible it is faulty.
Lots more details.. really important things like did the ethernet connectivity leds go on.. both the TC port and the modem port - front ethernet indicator should light up.. -
When recently synchronising my iphone it suggested to uograde to latest software. Now none of my sounds can be changed. Have gone to setting and tried to edit but the only sound I get is Marimba despite a different ringtone being selected?
I also lost my ringtones. I have spent about $100 dollars on ringtones to apply different songs to different callers...and now i can't find them.
-
Do I need to pay for 100dollars for A short time training and help me set up my MacBook pro at the first time
No. Go to an Apple store, and it will have a schedule of training seminars. If you have a quick question, you can make an appointment with a Genius. Finally, actually the first thing you should have done, you should familiarize yourself with the online documentation and videos.
Maybe you are looking for
-
Multiseat with Lightdm broken after updating Mesa
Hi, I've been using a multiseat configuration for months now, and it was working almost perfectly (almost - multiseating is far from being really stable yet IMHO, but anyway). I updated mesa-libgl a few days ago and confirmed packages replacement, bu
-
Hi iam copying data to table control from ztable. say i copied into my table control 20 rows. sayy i have my 18 row material field incorrect, i have an error message. for some reason my loop in PAI does looping for only first 11 rows. After the 11 ro
-
User Name and Password for JCO RFC call to BAPI
Hi all, What I think I know: --We do NOT have Single Sign On configured so don't tell me to use SSO please - I agree, but... --We have a requirement to do a goods receipt which prints labels for the handling units .....The printer to which the label
-
Trouble rationalizing use of multi-threading in run of the mill servlets
Hey everybody, While spending time writing an internal wiki article on servlets for work, I asked myself a very basic question: What does multi-threading buy average servlets where the business logic requires procedural handling of the request? Don't
-
Syncing podcasts on laptop main PC?
Hi, How do I not re-subscribe and re-download all my podcasts between two PCs? For example my main PC has 10 podcasts subscriptions and some 30 videos. How do I make the iTunes on my laptop subscribe to the same podcasts without manually subbing to t