How to load a file from a URL using DataStage

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
saraswati
Premium Member
Premium Member
Posts: 149
Joined: Thu Feb 28, 2008 4:25 pm

How to load a file from a URL using DataStage

Post 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!!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What have you tried? There is a specific "URL/File pathname" option in the stage, have you tried using that?
-craig

"You can never have too many knives" -- Logan Nine Fingers
saraswati
Premium Member
Premium Member
Posts: 149
Joined: Thu Feb 28, 2008 4:25 pm

Post by saraswati »

By stage what stage do you mean?
vinsashi
Participant
Posts: 150
Joined: Mon Aug 20, 2007 4:52 am
Location: singapore

Post by vinsashi »

Use FTP stage. give URL , username and password then define metadata,specify file format(delimeter and all)

Thanks
vin..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
saraswati
Premium Member
Premium Member
Posts: 149
Joined: Thu Feb 28, 2008 4:25 pm

Post 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
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post 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
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Poor old ClickPack, we miss her. :cry:
-craig

"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post 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
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
saraswati
Premium Member
Premium Member
Posts: 149
Joined: Thu Feb 28, 2008 4:25 pm

Post 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!!
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post 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
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
lstsaur
Participant
Posts: 1139
Joined: Thu Oct 21, 2004 9:59 pm

Post 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.
Post Reply