sam15
asked on
perl_batch_prog
i have a perl program that simply moves CD files from a unix named directory on solaris machine A to another directory on machine B. Then it copies CD files from machine B to C.
WIth every move i want to update an oracle database with the movement data (that CD exists on machine B or deleted from machine A ,etc). What are the different methods to do that? we are thinking of using LWP and post data via http to oracle about the updates. Problem is that if DB is down or some error occur. it is not very robus for error logging and handling.
any ideas.
WIth every move i want to update an oracle database with the movement data (that CD exists on machine B or deleted from machine A ,etc). What are the different methods to do that? we are thinking of using LWP and post data via http to oracle about the updates. Problem is that if DB is down or some error occur. it is not very robus for error logging and handling.
any ideas.
You could use the DBI module in perl to connect to oracle. You could then use SQL statements to update the database, and be informed if there are any errors.
i think you should definitely go for DBI module of perl installation because that is like a programming language of perl to support database programming. I think it supports arrays, error handling better than what you are saying.
ASKER
one of the issues for suing DBI is that one server is outide firewall and database is inside firewall. only port 80 is open. I think DBI will need a different port or direct connection. would sending http messages for updates work or it is a big risk.
if we use http how would you handle messages sent and no response come back from DB or some error occurs and you get an error message. is there a good way of handling those issues with stateless http.
if we use http how would you handle messages sent and no response come back from DB or some error occurs and you get an error message. is there a good way of handling those issues with stateless http.
Since it sounds like you are only doing updates (not select), you only need to know if the request was successful or not. There is no data you need.
For this, I'd create a page on the server that lets the client (LWP) send some specific data (either with GET or POST), and returns a very simple page indicating the status. It will be fairly easy for the client (perl program) to parse that page to find out if it was successful or not.
For this, I'd create a page on the server that lets the client (LWP) send some specific data (either with GET or POST), and returns a very simple page indicating the status. It will be fairly easy for the client (perl program) to parse that page to find out if it was successful or not.
ASKER
yes that is how we plan to do it. but is this "reliable" way of building a system to talk to each other and handle errors. Someone mentioned web services. not sure how would that be better.
There are some selects. Server will be executing a auery and returning data to perl to parse.
There are some selects. Server will be executing a auery and returning data to perl to parse.
It's not as reliable as directly connecting to the DB, but you don't have that as an option.
If the server needs to send data back, it should do so in an easy to parse format, like CSV.
If the server needs to send data back, it should do so in an easy to parse format, like CSV.
ASKER
1. can perl call oracle stored procedure instead of passing the sql as a string using DBI?
2. is there any other options other than DBI and HTTP?
2. is there any other options other than DBI and HTTP?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
it seems the issue is related to uploading files without line feed. LWP seems to error when buffering it to memory. if you upload the file from disk it does not happen. have you seen this before with LWP on file uploads.
I'm confused by your latest comment. How are you moving files? Is the LWP to talk to the DB? Are the files being uploaded to the DB?
ASKER
it has two compnents: one copies files from machine to machine and another uses LWP to upload a few of those xml files to DB.
Does the file upload work if you use a web browser to upload the file?
If so, post your LWP code.
If so, post your LWP code.