Month: September 2006

Oracle JDeveloper and Tomcat

It’s easy enough to tell JDeveloper that you want to deploy to Tomcat, it just needs the path to the webapps directory and forges on …

Tomcat Database connection pools

To get these with JDev you have to run Toplink, somehow persuade Orion (their embedded J2EE server) to run the naming service and all that jazz. I just wanted a simple thing with Tomcat, which is dead easy and does’t tie you up in Oracle knots.

After a lot of pain I eventually read the manual . Dead easy if you follow the instructions.

However you need to create a file called context.xml that lives in the METAINF directory.

Again – dead easy. Just create a METAINF directory under public_html in your JDev project folder and put it there. It just deploys.

Hope this helps the next Joe – took me most of several evenings to get to the bottom of it.

Have fun. 

Tomcat doesn’t like valid ?

Yeah, well, I had a servlet mapping element in my web.xml that looked like this:

  <servlet>
    <servlet-name>ProductHandler</servlet-name>
    <servlet-class>sop.ProductHandler</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ProductHandler</servlet-name>
    <url-patter>/producthandler.do</url-patter>
  </servlet-mapping>

Nothing wrong with it, but good ole Tommy kept saying

SEVERE: Occurred at line 39 column 21

Which was the end of the servlet mapping tag. No idea what the problem was. I changed the name from ProductHander to Prod and it worked, then I changed it back again and it was fine. No idea. Just thought I’d mention it. Maybe my IDE had put a control character somewhere? 

Got through my exam; not feeling to good now

Got through the SCWD exam OK with plenty of room to spare. Not the score I would have liked but OK.

Felt dreadful over the weekend and, come Monday, I could’t move – ear infection and nose pouring out nasty crap. Then my temporary filling for my root canal came out – suspect it was pressure from the infection that pushed it out.

I’m not in any pain, just feel lousy. I daresay the folk at work think I’m putting it on but I’m not. In a very high stress environment at the moment. We have only a few days to do a month’s worth of work. Thing is, I finished the first cut ages ago and it was never given a thorough test – now we have performance problems and all sorts of other crap – and its all my fault and people are giving me hassle. If you don’t allocate resources to a job don’t expect it to be done on time.

In project management there is a three-legged beast that will always bite you:

Quality/Time/Resources

Push any one of these and the others will suffer. Not exactly rocket science, is it?

Java 6 and JDBC

http://www.regdeveloper.co.uk/2006/09/22/jse_bling/  

I want to be able to do something like I can do in the Oracle ‘C’ preprocessor:

EXEC SQL FOR :count
INSERT INTO FRED (FRED_ID)
VALUES (:a_fred_id);

where count says how many and the a_fred_id variable is an array. I know this is pre-processed code but it is available in the non-pre-processed environments as well. Obviously there is syntax for bulk fetching as well.

The current JDBC junk, where you fetch each record one at a time, has always seemed to me to have too much Microsoft/whoever ODBC heritage; everything is talking to Access on the same DOS machine.

Last time I looked into this they did allow you to send multiple statements, which was OK but so what? Array binding is genuinely useful and if too hard to implement for a given SQL engine then throw an exception saying so.

Many years ago a colleague did the array binding in C++ and then linked these C++ objects into Java. This was a factor of 10 (or maybe more) times faster than JDBC. If you are retrieving a list of, say, order lines, why on earth would you want them one at a time anyway? If you are retrieving a list of big XML documents again, you want them in the most network-efficient manner.

My opinion – and someone will doubtless tell me there is a way to do this, probably using Business Delegates which pass arrays back – fine, but why can’t I have the whole array straight from the database in the first place?

SCWD exam tomorrow

… and I feel woefully underprepared. I’ve managed to move my score from 60% to 80% in the mock exams. The pass is 62% so I think I will get through. Annoying – I wanted to have a shot at 100%.

Have’t been too well over the last couple of weeks and it’s been hard to get information into my head.

Lots of pressure at work as well, I got told off because I took Friday off to study. Never been told off like that before in my entire career.

I’m in the middle of fixing some stuff that could have been fixed months ago, when it was first written, if the people in the know had tested it then. It now has lots of rough edges that need to be removed and we’ve got about 5 days to do it in. 

Somehow this is supposed to be my fault and I’m supposed to care. I do, inasmuch as I’m a professional and want to see things through, but I don’t inasmuch as it is’t a crisis of my making and I’m not taking responsibility for a lack of bodies on the ground.

Off to bed now, gonna get up early and do some more cramming. 

Letter to my MP

Go have a look here and here

Dear Frank Field,

I read with some concern today that the DfES has given the green light for schools to fingerprint children without their parents’ permission, and in fact it has already happened many times.

I am disgusted by this. Is this going to be Mr Blair’s lasting legacy? In the days when I was a child fingerprinting was for criminals. I have no time for criminality but I do not see why my kids need to be guilty until proved innocent. How long will it be before these records are put into police databases and used as a matter of course?

There has been a horrendous attack on my rights over the last few years and, as far as I can remember, none of this was in your manifesto. I am tired of the government interfering and getting in the way of my relationship with my family. I don’t give a fig how worthy the arguments for this may be – please keep big government away from personal relationships and please keep it away from assuming a non-adult can give informed consent – this is totally disgusting. The people in the DfES should be ashamed of themselves, they really should.

Yours sincerely,

A little SQL puzzle

create table zz ( x integer, y integer ) ;

insert into zz values( 1, 2) ;
insert into zz values( 1, 2) ;
insert into zz values( 1, 2) ;
insert into zz values( 1, 3) ;
insert into zz values( 1, 4) ;

select * from zz ;

X    Y

1    2
1    2
1    2
1    3
1    4 

create table yy as select * from zz ;

update yy set y = 5 where x = 1 and y = 2;

select * from yy ;

X     Y

1    5
1    5
1    5
1    3
1    4 

update zz set ( x, y ) = ( select x, y from yy where x = zz.x and y = zz.y );

— Before you type in the next bit try and work out what you think will be in zz now

— and try and work out why

select * from zz ;

drop yy ;

drop zz ;