Piyush Mattoo

Ranch Hand
+ Follow
since Mar 12, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Piyush Mattoo

Am trying to archive the previous war file for a Java based web application before i deploy the latest one via the Tomcat 6 Manager web-interface. Would highly appreciate if anyone can throw some more light on achieving the same.
7 years ago

Here mart.xml is a shortcut present in C:\Param\Bin on a windows box. I get the following IOException:

Exception in thread "main" java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.Socket.connect(Socket.java:524)
at java.net.Socket.connect(Socket.java:474)
at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
at sun.net.NetworkClient.openServer(NetworkClient.java:118)
at sun.net.ftp.FtpClient.openServer(FtpClient.java:488)
at sun.net.ftp.FtpClient.openServer(FtpClient.java:475)
at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:270)
at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:352)
at JDOMElementTextContent.parseXml(JDOMElementTextContent.java:36)
at JDOMElementTextContent.main(JDOMElementTextContent.java:47)

I tried to open Stream from URL using file: protocol but URLConnection.getInputStream throws the same connection refused exception.

Any recommendations would be appreciated?
9 years ago
I know how to print from the file system using Java Print Service API bit i was wondering if there is a way to print the HTML web page. Now, you can convert the HTML to Post Script (.ps file format) but i am hoping to see recommendations around the same with some sample code. So, in short i am looking for an easy way around converting HTML web page to Post Script format so that i can print the HTML page or alternatively any other Java based library around the problem of printing HTML web page using Java.

Piyush
SCWCD-1.4, SCJP-1.4, CSM
9 years ago
Thanks David for the response.
Our batch processes run once a day and i would imagine this conversion process would also happen then once a day sometime before the loader executes. Any recommendation for using any tool for doing the conversion in an automated manner?
9 years ago
We have a batch job written in Java which accepts data in the form of files in CSV format. Would it be better to have data coming in XML format since then we can have a schema to maintain consistency across dataset and validate the data against the schema. Do we have any such facility in CSV file format?
Also, is there any way to continue accepting files in CSV format and convert them over to XML at our end? Any good practices around that?

Thanks in advance!
9 years ago
What are the pros and cons of cewolf over JFree charts?
What would be some applicable web framework available for medium-small sized web applications involving charts based in Java.
I would highly appreciate if anyone could provide their opinions.

Thanks in Advance!
@Andrew: I would imagine i cannot order by timestamp though i can by MONTH_YEAR which would give me the
alphabet ordering.

You are right, No need of replace function

@Ireneusz: Point noted. This does work. Only thing is that for past 24 months, we need to subtract 23 months from sysdate.
WHERE "TIMESTAMP" >= TRUNC((ADD_MONTHS(SYSDATE, -23)), 'MM')

Thankyou for your valuable opinions.
I am retrieving the data from Oracle using JDBC API. I want to get the last 24 months starting from current month and the respective count of records.
I wrote the query as shown below:
(TIMESTAMP is of Data type DATE)

However, i cannot order by MONTH_YEAR as that will be ordered by alphabets(A,B,C..) as MONTH_YEAR is a string.
What i would appreciate is if anyone could point me how to order the result by date either on the DB query or on the Java end.

Thanks in advance!
Me Too.
My Procedure is:-
CREATE OR REPLACE PROCEDURE PROCESS_ARRAY(v_str_array IN Str_Array)
IS
TYPE Str_Array IS VARRAY(7) OF VARCHAR2(50);
v_array Str_Array;
BEGIN
FOR i IN v_str_array.first .. v_str_array.last LOOP
DBMS_OUTPUT.PUT_LINE('Output '||v_str_array(i));
END LOOP;
END;

The JDBC code to call the procedure is:-

proc_stmt = con.prepareCall("{ call PROCESS_ARRAY(?) }");
ArrayDescriptor descriptor =
ArrayDescriptor.createDescriptor("Str_Array", con);
ARRAY array_to_pass =
new ARRAY(descriptor, con, strArray);
proc_stmt.setArray(1, array_to_pass);

And i see the error- "java.sql.SQLException: invalid name pattern: <Schema-Name>.Str_Array"
Yeah..i tried executing about 100 records together in a batch and committing them but there seems to be no improvement whatsoever.
I have to insert 100K records into a table having 4 fields. Normal JDBC Insert seems to load 2K records per minute. Any ideas how to improve the execution time?
The flow is something like this:
Open a connection.
Read the record from a .txt file inside a loop.
Issue executeUpdate to insert the record.
Commit after every 10 records. (Tried autocommitting or commiting after x records; where x were different combinations)
Outside the loop, when all the input have been read; i close the connection and file reader, Buffered reader objects.
In the finally block, i close the Statement, connection objects.


TIA!
Does MERGE statement in Oracle 10G operate on a single table? If yes, can anyone pass a sample code snippet to show how?
I want to Insert into a single table with 4 fields; in case one of the field is already present in the table, then nothing should happen else if that field is not present then i would Insert that record.
I would highly appreciate if anyone throw some views on this.
TIA!
11 years ago
I have to insert 100K records into a table having 4 fields. Normal JDBC Insert seems to load 2K records per minute. Any ideas how to improve the execution time?
The flow is something like this:
Open a connection.
Read the record from a .txt file inside a loop.
Issue executeUpdate to insert the record.
Commit after every 10 records. (Tried autocommitting or commiting after x records; where x were different combinations)
Outside the loop, when all the input have been read; i close the connection and file reader, Buffered reader objects.
In the finally block, i close the Statement, connection objects.

TIA!
11 years ago
How about calling the Oracle SQL Loader .exe file from your Java code!!!