Ashu Bharadwaj

Greenhorn
+ Follow
since Nov 16, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ashu Bharadwaj

Thanks for the reply.

I tried by putting Action classes in jsp folder. I copied from WEB-INF/classes to jsp folder in Tomcat6.

Still getting the same result.
12 years ago
Hi,

I am getting error No configuration found for the specified action: 'Login' in namespace: '/jsp' Form action defaulting to 'action' attribute's literal value.

I have checked the mapping for the action: Login in struts.xml and in JSP.

[


And struts.xml looks like:
</action>
<action name="Login" class="com.action.ReportAction" method="execute">
<result name="success">./jsp/index.jsp</result>
<result name="input">./jsp/Login.jsp</result>


JSP page looks like:
<s:form action="Login" method="POST" validate="true" theme="simple" >


</action][/code]
12 years ago
Can you please provide algorithm for calculating 95th percentile
Hi,

Which is the best solution for calculating 95th Percentile: calculating in Java code or in SQL. Need efficient way. The input file is large.

Wouter Oet wrote:I'm not familiar with GWT but doesn't it have a number-only-textbox or something similar? You can always use Integer.parseInt()



Thank you for your insight.
14 years ago
Hi,

How to parse integer value entered in TextBox in GWT?

Thanks
14 years ago

Martin Vajsar wrote:Ashu,

first of all, please restate your goal. The code I've written searches for rows that exist only in the first, only in the second or in both resultsets, processing all rows from both resultsets. This is what I understand by "comparing resultsets". If you only want to see whether a single row from one resultset is present in the other one, please see my first response.

Secondly - if you want to create a generic solution, that will be lots and lots of work. I've assumed that the column names and types are known. Since I've never need to process a resultset generically, I can't really effectively help you with this approach. If you want some help from me, please start with a non-generic example, where the query is known and the resultset contains a known set of columns of various types. I can help you make such example work, but to turn it into generic algorithm will be then up to you.

And lastly, you didn't follow the template I've already given you. The logic in your solution will not work. See how I have arranged calls to the resultsets' next() methods and try to figure out why is this so.

[/Hi Martin,
I wanted this class as I had to migrate rows from one DBMS to other DBMS. The first one is Oracle 10G and the otherone is Oracle 11G. Befrore I migrate rows I need to check if the rows already exist in the new DBMS or not. We are moving to 11G but we are using both 10G and 11G for inserting app data for some time.

Now, number of columns in 11G may be equal or more than 10G.

]

Ravi Kiran Va wrote:Hi Ashu Bharadwaj , rather than comparing the ResultSet directly , What you can do is take the ResultSet data into ArrayList and compare both the ArrayLists .



[Thanks Ravi, could you please tell me the advantages that I will have in using ArraLists. Please let me know more about the implementation.
Thanks]

Martin Vajsar wrote:

Ashu Bharadwaj wrote:
Could you please provide me pseudocode for iterating through records. The resultset is not too large, so we can iterate through the records.


Very briefly:


The compareRS method compares values of columns that were used in the ORDER BY clause of the two recordsets in order in which they were specified. If the values in the first column are equal, compare values of the second one, till all columns are compared or a difference is found. The returning value should follow the standard Java convention.

The comparison must be done identically with the database. If your data may contain null values, handle them as the database does (ORDER BY usually allows to specify NULLS FIRST or NULLS LAST, if not, determine the convention of your database and use it). If you process strings that may contain international characters, the best bet is to use non-lexicographical ordering in the database. It is usually the default, however it might also be affected by database connection/session settings.




I wrote this Class for comparing rows. What changes do I need to make to see if the if row of rs1 is subset of rs2, i.e., exists anywhere in rs2.

Martin Vajsar wrote:

Ashu Bharadwaj wrote:
Could you please provide me pseudocode for iterating through records. The resultset is not too large, so we can iterate through the records.


Very briefly:


The compareRS method compares values of columns that were used in the ORDER BY clause of the two recordsets in order in which they were specified. If the values in the first column are equal, compare values of the second one, till all columns are compared or a difference is found. The returning value should follow the standard Java convention.

The comparison must be done identically with the database. If your data may contain null values, handle them as the database does (ORDER BY usually allows to specify NULLS FIRST or NULLS LAST, if not, determine the convention of your database and use it). If you process strings that may contain international characters, the best bet is to use non-lexicographical ordering in the database. It is usually the default, however it might also be affected by database connection/session settings.



Could you please give code for compareRS. Thanks

Martin Vajsar wrote:What you describe is a way to locate any record in a resultset based on column values. Short of iterating through all records and comparing the column values searching for the match I don't see another solution. However, I'd probably run a query searching just for the desired column values. Much better than bringing all of the table from the database to the client and iterating through it.

However, using either of the above to really compare two resultsets (ie. repeating the search for every record in another resultset) would be grossly inefficient, especially with large resultsets. It is really a bad idea.

The best way to compare resultsets, in my opinion, is to sort both ResultSets (using ORDER BY clause) by the same criteria, ideally by a primary key, if it is the same in both tables, or by all of the common columns of the two queries. Then it is possible to identify identical and missing records in one pass over the contents of the two resultsets (you'll go to next record in the resultset that contains the "lesser" of the two records, if the two records are equal, you'll go to next record in both resultsets).

Another way would be to bring the two databases together (eg. using a database link, if your database supports one) and doing all of the work using MINUS and UNION operators. This would be much less code to write, however the database links bring up some administration overhead.



Thank you for your insight.
Could you please provide me pseudocode for iterating through records. The resultset is not too large, so we can iterate through the records.
Hi,

I have two ResultSet from two different DBMS. I want to check if the entire row of the first ResultSet exists in the second ResultSet.
It could be anywhere in the second ResultSet. Number of rows and columns in second ResultSet may be more than the first one.

So, I want a class which will return true, if the one row of first ResultSet exists anywhere in the second ResultSet table.

Campbell Ritchie wrote:Is your problem with the Timestamp#toString() method, or do you wish to change the date to show 00:00:00.00 as the time Do you need to set hours minutes and seconds to 0 on the Calendar object before passing it to the Timestamp?

And which TimeStamp do you mean?There is no TimeStamp in the Oracle API but there are two Timestamp classes.



Thanks for your response.

What I intend to do is that convert Calendar object to TimeStamp. In the code I created a Calendar object calendar and time it has is in GMT , e.g., 05:15:20.
(current GMT)

When I display the TimeStamp it shows : 11:45:20 , which is IST, (I want it to display 05:15:20 GMT )
14 years ago
Hi,

I created a Calendar object and assigned some date to the Calendar object. Now I constructed TimeStamp using the Calendar object. The constructed TimeStamp gets the current time of the system in millis. However, I wanted the Calendar objects's date to be assigned to the timestamp.
See the code

14 years ago