Sorry for this trivial question, but I am new to programming and I wanted to create a Java app that can be distributed to other computers without having to install database on that computer.
The app is similar to an address book app where you store details about a person. Is there a way to create something like that using netbeans which does not require a database or is there any other way to go about it..
I have searched for answers, but I guess I am not searching for the right keywords which I’d appreciate if someone could enlighten me with.
PS: I know how to create an app like that in netbeans which is connected to a database (Mysql or Postgresql) but they cannot be moved from one computer to other? Or can it be? I don’t know.
Thanks you in advance..
When I want to make a Java program relying on a database and which is lightweight and which doesn’t appear to have any other dependencies than a JVM, I use Apache Derby (JavaDB).
It is a pure Java database engine which you can embed in your Java application. Very small footprint. I usually package the program with a SQL file for creating the database structure and another one for populating it. Worth taking a look IMO.
EDIT: Just saving you the search… If you try DerbyDB, there is a little something you want to know (in case you also have that syndrome of not reading manuals)… When you close Derby, it throws exceptions if it went wrong AND if it went well. You’ll receive exceptions with
exception.getSQLState().equals("08006")and"XJ015". These are for successful shutdown; don’t mind them. On connection to Derby, you’ll getexception.getErrorCode() == 40000if the database was not yet created; just create it. (These exceptions are all SQLException instances.)