Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / April 2006

Tip: Looking for answers? Try searching our database.

Updating from PointBase to Derby

Thread view: 
KAR120C - 23 Apr 2006 00:40 GMT
I recently bought Sams Teach Yourself J2EE to learn the Enterprise Edition
from scratch.  The book has one main application that it develops.  The
problem is it uses the PointBase database which Sun replaced with Derby on
December 5th.  I am unable to get started, because being new to the EE, I do
not know how to replace the following two lines with the Derby equivalent:

private static final String driver = "com.pointbase.jdbc.
jdbcUniversalDriver";
private static final String protocol = "jdbc:pointbase:server://localhost/sun-
appserv-samples,new";

I think if I can get past that, I can get started with the book.  Has anyone
else encountered this?  Any help would be appreciated.  Thanks.
Rhino - 23 Apr 2006 23:52 GMT
>I recently bought Sams Teach Yourself J2EE to learn the Enterprise Edition
> from scratch.  The book has one main application that it develops.  The
[quoted text clipped - 12 lines]
> anyone
> else encountered this?  Any help would be appreciated.  Thanks.

You might get a better answer on comp.lang.java.databases; someone there may
have used Derby. Or try looking for the Derby documentation; it must have
information on how to write the driver and protocol strings.

--
Rhino
svella@technologist.com - 29 Apr 2006 01:49 GMT
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:"


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.