Page 1 of 1

How to load a file from a URL using DataStage

Posted: Mon Jan 11, 2010 11:50 am
by saraswati
Hello friends,

As per my requirement I need to read a file(say file1 as also depicted below in the url) which would be posted on a URL.
The URL is somewha like:
http://abc.com/group/files/file1
I need to use DataStage Jobs to do this.

Kindly advise and let me know if I need to give further details.

Thanks in Advance!!

Posted: Mon Jan 11, 2010 2:25 pm
by chulett
What have you tried? There is a specific "URL/File pathname" option in the stage, have you tried using that?

Posted: Mon Jan 11, 2010 11:40 pm
by saraswati
By stage what stage do you mean?

Posted: Tue Jan 12, 2010 1:40 am
by vinsashi
Use FTP stage. give URL , username and password then define metadata,specify file format(delimeter and all)

Thanks
vin..

Posted: Tue Jan 12, 2010 6:41 am
by chulett
For some reason I was thinking 'XML' when answering you, so what I meant was the XML Input stage... however, the FTP stage should be the correct answer here though personally I've never tried sourcing from a URL with it. Give it a shot, let us know.

Posted: Wed Jan 13, 2010 6:20 am
by saraswati
The problem is the web url: http://abc.com/group/files/file1
is not a FTP server but an HTTP one and hence we donot have a username/password to access it. Its like an intranet url where files are posted and is hosted on an apache server and you can download files from there.
This is the reason I am unable to use an FTP stage to access the files.

Please help!! Thanks in Advance

Posted: Wed Jan 13, 2010 7:25 am
by eostic
I've seen it done with JavaPack and long ago with the old Perl Stage.

Today, write a java class that can get the document via HTTP and then you can parse it as appropriate and send the rows down an output link.

Ernie

Posted: Wed Jan 13, 2010 7:53 am
by chulett
Poor old ClickPack, we miss her. :cry:

Posted: Wed Jan 13, 2010 9:26 am
by eostic
Ah yes....it was a fun time in the early web-bubble days. The sessionizer was the most interesting.......thought it was going to make a comeback, but alas, not enough demand...into the bin with other cool stuff from the past like the Job Edit API.... ; )

Ernie

Posted: Wed Jan 13, 2010 11:51 am
by saraswati
Well since I do not have the Java Pack is there really no other way to load a file from a http url, like the WebServices Pack or etc?

Did anyone else faced sort or this requirement and fixed it. Please advise! Thanks in Advance!!

Posted: Wed Jan 13, 2010 12:02 pm
by eostic
JavaPack is there....we don't call it "JavaPack" so much anymore because it is no longer a chargeable item. Look for the Java Transformer and Java Client Stages in your palette... Doc is in lots of places also, and with lots of entries here in this forum, and I have some samples at my blog noted below.

Ernie

Posted: Wed Jan 13, 2010 12:21 pm
by lstsaur
Yes, Java stages are included in your V8. You need to know how to use URLConnection, BufferReader in your Java stage to access the file on the URL.