Thursday, January 31, 2008

Using the instructions mentioned in the previous post I'm going through and creating myself a toy configuration for this app.

I had thought previously that I could just create a new project in MyEclipse and use MyEclipse's "add capabilities" features to get the stuff I want. But MyEclipse doesn't, as of yet, support Struts 2. So I'm going to stick with doing things the old fashioned way.

First step -- grab Tomcat and install it -- as expected, no problems there. Configure MyEclipse to recognize this Tomcat installation by going to Preferences -- MyEclipse -- Servers -- Tomcat -- Tomcat 6, click "Enable," click the "Browse" button next to "Tomcat home directory," and find the root of my Tomcat installation. The other arguments are automagically populated from there, hit Apply, hit OK. Go down to the 'Servers' tab in MyEclipse, select this Tomcat 6 server, click the exciting green start arrow, Tomcat starts up just fine.

Now start up MySQL -- hm, it won't start -- check properties for the MySQL service, find that it points to a directory that doesn't exist.

I should point out that this is an inherited machine that wasn't wiped before it was handed over. Sigh.

So, grab MySQL, install it -- now everything seems OK, except that I have an old, nonfunctional MySQL service in my service list in addition to the new functional one. I'll live.

Make a note in my lab notebook as to the usernames and passwords for Tomcat and MySQL. Yes, it might be slightly insecure but my memory is even less secure.

These quickstart instructions next provide a handy little SQL script to create a 'Person' table. Open up the MySQL Query Browser, open a new script tab, copy, paste, execute -- no dice. Syntax error. Huh. The syntax looks right to me:

CREATE TABLE 'quickstart'.'Person' (
'id' INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
'firstName' VARCHAR(45) NOT NULL,
'lastName' VARCHAR(45) NOT NULL,
PRIMARY KEY('id')
)
ENGINE = InnoDB;

But the MySQL query browser is complaining that I've got a syntax error near the second line. OK, let's check out the online refs, what is the correct syntax for CREATE TABLE in MySQL 5.0? I should mention that MySQL's online reference is just great, at least for this basic stuff. Detailed syntax, lots of examples.

Poke around for ten minutes to look for answers to this, can't find any. Ten minutes seems like a good enough time-boxing, so I'm just going to use the MySQL query browser's GUI to replicate the same code that is here.

Just for reference, here is the autogenerated SQL that the query browser came up with to create this table after I did the happy clicky:

DROP TABLE IF EXISTS `quickstart`.`person`;
CREATE TABLE `quickstart`.`person` (
`id` int(10) unsigned NOT NULL auto_increment,
`firstName` varchar(45) NOT NULL,
`lastName` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Grand.

No comments: