Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[stellation-res] A database question

I've been working on a unit test suite, initially for testing ACLs, but
with the intention of using it to create a fixture that will also be
easy to expand into a general client-independent repository test suite.

One thing that I've come up against is the need to be able to create
and destroy databases. Since unit tests need to be independent, and I
expect the suite to wind up with dozens of tests, it's not reasonable
to expect the user to set the databases up in advance, and it's not
really reasonable to leave all of those databases lingering after the
tests have run.

My question is: for the databases that you know about, can you create
and destroy databases using JDBC?

In postgres, as long as you are connected to a database, you can execute
"create database" and "drop database" commands. So starting with an
initial seed database owned by Stellation, it's easy to create and drop
databases entirely through JDBC. 

In DB2, we create one database, and then create tablespaces for
repositories. According to the DB2 docs, creating tablespaces can be
done from JDBC.

The Firebird docs are ambiguous. They discuss the "create database"
command in the SQL language guide, and say that it's usable from a
variety of places, but that document never discusses JDBC. I suspect
that it will work much like postgres, but since I don't
have Firebird properly configured an my machine (yet), I haven't been
able to test it.

I don't know about MySQL, or Oracle. If you can give a definitive answer
about Firebird, MySQL, or Oracle, please let me know.

If the answer to this is yes for all of the databases that interest us,
then I'm going to add methods to the AbstractDatabase class for database
creation and deletion. This makes the tests easier to write, and it
means that once a database is installed and the stellation user is
configured, you can just create repositories without having to know
the particular incantation for database creation in your database.

Thanks,

	-Mark

-- 
Mark Craig Chu-Carroll,  IBM T.J. Watson Research Center  
*** The Stellation project: Advanced SCM for Collaboration
***		http://www.eclipse.org/stellation
*** Work Email: mcc@xxxxxxxxxxxxxx  ------- Personal Email: markcc@xxxxxxxxxxx




Back to the top