hello how r u doing ..

i have been looking on the internet but i cant find much info ..
does anyone know where i can find information about making a database in java?

(i expect it is has information about arrays, arraylist, iterators and inheritance) ...

i want to try make a simple one but i need some help and thats
why i am looking if i can find info about it ..

thanks ..

A DBMS in Java ? Bravo !!!
This thread will offer you a whole lot of information about starting java. But to write your own DBMS in a langauge I guess you will have to look far beyond a particular "link" or site. This will need in-depth knowledge and understanding not to mention much experience in the langauge to be achieved.

lol, yes for sure!

I currently working and learning java under a person who actually worked as a team leader for creating DB in java for Indian company.

Its not easy and need lot of time for planning and then work on it.

But if you want to use it for your project/software only (Simple one). then i will suggest you to use ArrayList for each table and must dynamically create a class for that table on JavaBeans (getter/setter for each attribute) and store objects of that class in that ArrayList (one object for each inserted row).

To keep record saved, Use IO classes and save it in files.

btw, If you are really serious about it, then i would like to work with you on it.

Waiting for your reply!

Regards,

thanks for the help

well i am serious about it but i dont want to make a very complicated one ..

we are expected to be able to do that in like 10 days lol ..
i have an exam and i need to make such a thing for college..

but the thing is .. we need to have a search function too ..
i already began with it but it is tough ..
my superclass is called Person
my subclasse are: Student and Teacher
and i am making another class called: PersonList which is supposed to contain the Arraylist and iterators if needed ..

this is what i have in mind for Person (the general concept)

import java.util.*;     // java.util is used for dates
public class Persoon
{
    /**
     * fields:  Last Name, First Name
     *          Sex and Birth date
     */
    private String LastName;
    private String FirstName;
    private String Sex;
    private int BirthDate;

    /**
     * Constructor of the class Persoon
     */
    public Person(String LastName, String FirstName, String Sex, int BirthDate)
    {
        this.LastName = LastName;
        this.FirstName = FirstName;
        this.Sex = Sex;
        this.BirthDate = BirthDate;
    }

by the way .. i am trying my best to achieve this becoz this will determine whether i will go on into programming or go more
into design and web development ..

thanks in advance ..

any advises are appreciated ..

So you are creating a kind of school management system.

Ok!

Structure:

Top Level Class: Person
Derived Classes : Student / Teacher

In same way create interface or abstract class : PersonList
Implemented Classes : StudentList / TeacherList

interface will hold prototype of few methods like add , delete and update ( common implementation can be done in abstract class, if used) plus search methods according to attributes.

If you will be using ArrayList then index number can be your primary key (this will help for searching).

Its done with project Data Objects,

Now, create a MainClass to use functionality of DO classes. This will be the basic structure, Once you have designed and worked on DO nicely then there are many ways to get the easiest and efficient management done.

Regards,

thanks a whole lot ..

if i may ask ..

what u just wrote is actually the main concept of what i need
to get my database running right?

if yes then i know how and where to look for information and what to try ..

could u tell me what packages to use in java?

thanks a lot

thanks a whole lot ..

if i may ask ..

what u just wrote is actually the main concept of what i need
to get my database running right?

if yes then i know how and where to look for information and what to try ..

could u tell me what packages to use in java?

thanks a lot

hello,

yes, im talking about same thing, to implement and use functionality of DO classes and make your DB running.

You can use java.util and java.io package.
http://java.sun.com/j2se/1.3/docs/api/java/util/package-summary.html
http://java.sun.com/j2se/1.4.2/docs/api/java/io/package-summary.html

best of luck!

thanks a lot ..
i will check it out ..
i have already finished the superclass person (i think lol)
i need to work on a subclass and see what to do with it ..

thanks again

thanks a lot ..
i will check it out ..
i have already finished the superclass person (i think lol)
i need to work on a subclass and see what to do with it ..

thanks again

great!
dont forget to set thread as solved and best of luck!

is this a good java code:

/**
 * Super class Person
 * 
 * @author Mohammed Doghman 
 * @version 1.0
 */
import java.util.*;     // java.util is used for dates
import java.text.*;
public class Persoon
{
    /**
     * Velden:  Naam, geslacht, geboortedatum en leeftijd
     */
    private String VoorNaam;
    private String AchterNaam;
    private String Naam;
    private char Geslacht;
    private Date GeboorteDatum;
    static SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
    private int LeefTijd;
    private String Opmerking;

    public Persoon(String AchterNaam, String VoorNaam, char Geslacht, Date GeboorteDatum, int LeefTijd)
    {
        this.VoorNaam = VoorNaam;
        this.AchterNaam = AchterNaam;
        this.Naam = Naam;
        this.Geslacht = Geslacht;
        this.GeboorteDatum = GeboorteDatum;
        this.LeefTijd = LeefTijd;
        Opmerking = "<no comment>";
    }
    
    public String VoorNaam() 
    {
        return VoorNaam;
    }

    public String AchterNaam() 
    {
        return AchterNaam;
    }
    
    public String setNaam(String Voornaam, String Achternaam)
    {
        Naam = (Voornaam + " " + Achternaam); 
        return Naam;
    }
    
    private void setGeboorteDatum (Date Geboortedatum) 
    {
        GeboorteDatum = Geboortedatum;
    }
    
    private void setGeboorteDatum (String Geboortedatum) throws Exception 
    {
        setGeboorteDatum(sdf.parse(Geboortedatum));
    }
    
    public int getLeefTijd () 
    {
        GregorianCalendar cal = new GregorianCalendar();
        int y, d, a;

        y = cal.get(cal.YEAR);
        d = cal.get(cal.DAY_OF_YEAR);
        cal.setTime(GeboorteDatum);
        a = y - cal.get(cal.YEAR);
        if (d < cal.get(cal.DAY_OF_YEAR)) {
            --a;
        }
        return (a);
    }

    private void setGeslacht (char g) 
    {
        Geslacht = g;
    }

    private void setGeslacht (String g)
    {
        if (g.startsWith("v") || g.startsWith("V")) 
        {
            setGeslacht('v');   // vrouw
        } else {
            setGeslacht('m'); // man
        }
    }
    
    public String GeboorteDatumString () 
    {
        return (sdf.format(GeboorteDatum));
    }

    public String toString () 
    {
        String g;

        if (Geslacht == 'v') {
            g = "vrouw";
        } else {
            g = "man";
        }
        return (Naam + "(" + GeboorteDatumString() + ", " + g + ")");
    }
    
    public String getOpmerking()
    {
        return Opmerking;
    }
    
    /**
     * print details van persoon
     */
    public void print()
    {
        System.out.print(Naam + GeboorteDatumString() + Geslacht + Opmerking);
    }
}// eind klasse persoon

No, there are a few shortcomings in this piece of code.

public String VoorNaam() 
    {
        return VoorNaam;
    }

    public String AchterNaam() 
    {
        return AchterNaam;
    }

You have defined two methods of the same name as that of the variables, they should be called getVoorNaam() and getAchterNaam() since it is the getter action that they perform.

Also it is best/common practice to have the attributes start with lower case:

private String achterNaam;

public String getAchterNaam() {
  return achterNaam;
}

public void setAchterNaam(String achterNaam) {
  this.achterNaam = achterNaam;
}

Notice how the case changes from lower case to capital at the get/set method:
achterNaam
getAchterNaam

It was a good think that you overridden the toString() method

This article has been dead for over six months. Start a new discussion instead.