Re: Updating from PointBase to Derby



I just ran into the same problem today. The following is what I did to
get it to the point where I could create the database and tables. Since
that is as far as I have gotten, I have no idea whether or not there
are any other changes that may need to be made. In particular, since
the type of the 'exact' column in the 'Matched' table changed from
boolean to smallint, there may be some other code that has to be
updated.

In CaseStudy/Day02/exercise/src/CreateAgency.java:

Redefined string constants:

private static final String driver =
"org.apache.derby.jdbc.ClientDriver";
private static final String protocol =
"jdbc:derby://localhost/sun-appserv-samples;create=true";
private static final String user = "APP";
private static final String password = "APP";

Redefined all the create table statements:

s.execute("create table Skill(name varchar(16) CONSTRAINT
pk_skill PRIMARY KEY, description varchar(64))");
s.execute("create table Location(name varchar(16)
CONSTRAINT pk_location PRIMARY KEY, description varchar(64))");
s.execute("create table Applicant(login varchar(16)
CONSTRAINT pk_applicant PRIMARY KEY, name varchar(64), email
varchar(64), summary varchar(512), location varchar(16), CONSTRAINT
fk_location FOREIGN KEY (location) REFERENCES Location(name))");
s.execute("create table ApplicantSkill(applicant
varchar(16), skill varchar(16), CONSTRAINT fk_applicant FOREIGN KEY
(applicant) REFERENCES Applicant(login), CONSTRAINT fk_skill FOREIGN
KEY (skill) REFERENCES Skill(name))");
s.execute("create table Customer(login varchar(16)
CONSTRAINT pk_customer PRIMARY KEY, name varchar(64), email
varchar(64), address1 varchar(64), address2 varchar(64))");
s.execute("create table Job(ref varchar(16), customer
varchar(16), description varchar(512), location varchar(16), CONSTRAINT
pk_job PRIMARY KEY (ref,customer), CONSTRAINT fk_customer FOREIGN KEY
(customer) REFERENCES Customer(login), CONSTRAINT fk_location_job
FOREIGN KEY (location) REFERENCES Location(name))");
s.execute("create table JobSkill(job varchar(16), customer
varchar(16), skill varchar(16), CONSTRAINT fk_job FOREIGN KEY
(job,customer) REFERENCES Job(ref,customer), CONSTRAINT
fk_skill_jobskill FOREIGN KEY (skill) REFERENCES Skill(name))");
s.execute("create table Matched(applicant varchar(16), job
varchar(16), customer varchar(16), exact smallint, CONSTRAINT
fk_job_matched FOREIGN KEY (job,customer) REFERENCES Job(ref,customer),
CONSTRAINT fk_applicant_matched FOREIGN KEY (applicant) REFERENCES
Applicant(login))");

In CaseStudy/Day02/exercise/build.xml:

Changed PointBasePool to DerbyPool

In CaseStudy/common/targets.xml:

Changed all instances of "com.pointbase.jdbc.jdbcUniversalDriver" to
org.apache.derby.jdbc.ClientDriver and all instances of
"jdbc:pointbase:server:" to "jdbc:derby:"

.



Relevant Pages

  • Re: New to SQL server
    ... [CONSTRAINT constraint_name] ... | [FOREIGN KEY] ... Is the name of the database in which the table is created. ... REFERENCES permission on the type is ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Create Table Issues
    ... unique index on BookID. ... > CONSTRAINT PubPK PRIMARY KEY ... > CONSTRAINT PubFK FOREIGN KEY REFERENCES Publisher ...
    (microsoft.public.access.gettingstarted)
  • Re: Foreign Key Problem errno 150
    ... CONSTRAINT `FK_tblstammblatt_aufsteck` FOREIGN KEY REFERENCES ... So interpretiere ich die Anleitung. ...
    (de.comp.datenbanken.mysql)
  • Problem merging two queries
    ... CONSTRAINT PRIMARY KEY CLUSTERED ... REFERENCES ( ... CONSTRAINT FOREIGN KEY ...
    (microsoft.public.sqlserver.programming)
  • Re: Modelling Disjoint Subtypes
    ... the only constraints one should have are foreign key references. ... I think the answer is that a foreign key constraint enforces a constraint between columns in two tables. ... these tables also have a primary key K which references K as a foreign key. ...
    (comp.databases.theory)