Sun – Week Forty

9 04 2009

This week I’m going to try and finish that email script…A while ago I was assigned the task of writing a module for our booking system.

The Problem

Engineers can book hardware to escalation numbers (customer cases), however, we know that a number of engineers take advantage of this, and book systems for other, more personal, uses under the same escalation numbers.
These bookings don’t end unless:
1) The engineer or a lab team member removes the booking, or
2) The customer case is closed.

The Solution

Create something that will check the database for bookings which have been active for more than X number of days and bug the engineer via email to see if they still need the system.

What I’m doing

So, after achieving this once in Perl (*spit*) and it being little good (because we want to trigger it from the database), I gave it another bash:
This time I’m using a stored procedure (from now on referred to as an SP) which will collect a list of bookings. This will then run a Java application, passing in the booking number as an argument. The Java application will then connect to the database again and call another SP which will recover the booking details (I couldn’t pass them in as arguments as the method of calling external scripts from the database is limited to 255 characters).

This is basically where I am now, at the end of the week. Next week I’ll need to find a way to get the Java application to email the user of the system, and maybe look at a better way of passing in a list of booking numbers, as having loads of these processes running could seriously slow things down…

I will, at some point, blog about connecting to a Sybase database using Java, this should be fairly generic, I just found other documentation for doing this very poor :(


Actions

Informations

  • Delicious
  • Facebook
  • Digg
  • Reddit
  • StumbleUpon
  • Twitter

No responses to “Sun – Week Forty”

14 04 2009
Rob Young (22:05:06) :

Sounds complicated!

Could you not trigger your Java app from the database as a standalone job and have the app do the querying (you could even encapsulate the resultset in a stored proc) instead of the other way round?

It could retrieve all the necessary information with one query, and from here it could email everyone it needs to based on the list of dated bookings retrieved – minimises DB interaction :)

Rob

14 04 2009
Ben Lavery (22:41:35) :

Yes, that would be a much better idea! Would help keep all the code a bit more together too, rather than it spilling from database to application!
Cheers Rob :D

15 04 2009
Rob Young (06:05:43) :

No problem – interested to hear about your gripes with Sybase; sounds nasty!

I wouldn’t have suspected it too much of a problem with JDBC ?

15 04 2009
Ben Lavery (08:02:24) :

The main problem last week was I was unsure how to find information about the database like version numbers, and access details (port number and database name for instance).
Once I found out these and managed to find the JDBC driver, it has worked pretty well! I’m not sure I like the Object the database returns, the ResultSet Object would, in my opinion, be better being scrapped and just let the database return an 2D array of Objects…But since I’ve now written my function to do something similar, it doesn’t matter too much :D

15 04 2009
Rob Young (09:56:49) :

Ah I see! I don’t think there’s much of a case for the ResultSet object to be scrapped, but it is very convenient to work with an ORM and be able to have a List returned :)

Hope you get it sorted! :D

17 04 2009
Ben Lavery (09:39:57) :

Well, after an email to the guy I’m doing this work for, he wants to spawn a Java app for each booking…
I’ll detail it more in this weeks entry…

17 04 2009
Sun Week Forty-One « #! (13:53:23) :

[...] Not a moment too soon either! OK, so I’ve listened to what Rob said in the comments from last weeks entry and started to re-plan things, plus sent an email to the guy I was doing the work for.  He came [...]

12 07 2009
#! » Sun Week Fortyone (12:56:30) :

[...] Not a moment too soon either! OK, so I’ve listened to what Rob said in the comments from last weeks entry and started to re-plan things, plus sent an email to the guy I was doing the work for. He came back [...]

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WP Hashcash