Menu

#6 example not postgresql-friendly

open
artimus (8)
5
2003-01-27
2003-01-27
Kaolin Fire
No

the hardest part here was noticing that poolman.xml
wasn't put in a default classpath... (as noted in
another bug)

howerever, the following things also took a bit of
figuring:

sql_article.properties --

article.table.create: postgresql doesn't seem to
support smallint(1), doesn't like indices defined in a
table create, and apparently has user as a reserved word.

the following worked:
article.table.create = CREATE TABLE artimus_article
(article INTEGER NOT NULL PRIMARY KEY,marked SMALLINT
DEFAULT 0 NOT NULL,modified TIMESTAMP,"user"
VARCHAR(15),host VARCHAR(15),contributed
TIMESTAMP,contributor VARCHAR(15),creator VARCHAR(79)
NOT NULL,title VARCHAR(255) NOT NULL,content TEXT,cost
DECIMAL(9,2) NOT NULL default '0.00');

article.insert.welcome: postgresql treats ticks and
quotes differently. quotes can be used (as above) to
mark something a columname as opposed to whatever other
function or keyword it may have been. as such, quotes
*can't* be used to mark strings.

the following worked:

article.insert.welcome = INSERT INTO artimus_article
(creator,title,content,article) VALUES
('artimus','Welcome to Artimus','This is a test article
that you can delete after adding your own.',100);

sql_keys.properties --

keys.table.create: postgresql doesn't liked marked as a
bit, at least not with DEFAULT 0 after it... changed
to a smallint to match the other table.

the following worked:

keys.table.create = CREATE TABLE artimus_keys (name
char(31) NOT NULL PRIMARY KEY, marked SMALLINT NOT NULL
DEFAULT 0,next integer NOT NULL DEFAULT 0);

after all that, create resources finally worked, with a
NPE in the home stretch that I haven't yet tracked
down. It doesn't seem to have affected the system.

I didn't see any simple spot in the properties file to
add the indices I took out of the articles.table.create
-- wasn't sure if you could put more than one sql
statement in a single property or not, guessed not.

thanks for the wonderful book (struts in action), and I
hope you'll see fit to make it a bit easier for folks
to plug other dbs into it. :)

Discussion

  • Kaolin Fire

    Kaolin Fire - 2003-01-27
    • labels: --> artimus
    • assigned_to: nobody --> thusted
     
  • Nobody/Anonymous

    Logged In: NO

    Sorry about that. I'll try to look at it this weekend. -Ted.

     
  • Ted Husted

    Ted Husted - 2003-02-08

    Logged In: YES
    user_id=3618

    Yes, I would to change the default to HSQL or perhaps to a
    stub database, to better demonstration Unit Testing within
    web applications.

    -Ted.

     
  • Nobody/Anonymous

    Logged In: NO

    is the poolman not being in the default classpath causing
    the "default" database to show up? I found poolman.xml and
    edited it but I still get configured to use mysql.

     

Log in to post a comment.