I would like to highlight, if you have finished installed the netbeans 6.8 together with the Glassfish V3, The Apache Derby is installed for your development automatically, it is named JavaDB. Anyhow when you move to the SIT/UAT/PROD, it should has a dedicated database server. Then it may nice if you have an experience and familiar about it instead of only the default development environment.
The database creation:
Case1 : use the pre-installed by netbeans 6.8 and GF v3
The database location:
You can find it by navigating through netbeans by following step: -
1. Go to "Services" --> "Databases" ---> "Java DB".
2. Right click at "Java DB" node, at the pop-up menu choose "properties". The system will give you information about "Java DB Installation path" and "Database Location".
The database version:
As my tracing through the netbeans as the following step: -
1. Go to "Services" --> "Databases" ---> "Drivers" ---> "Java DB (Network)"
2. Right click at "Java DB (Network)" node, at the pop-up menu choose "customize". The system will give you a location of Apache Derby JDBC jar file.
3. After I had got the "MANIFEST.MF" from that jar file,I got the information it is a version 10.5.3
The database creation:
1. Go to "Services" --> "Databases" ---> "Java DB".
2. Right click at "Java DB" node, at the pop-up menu choose "Create Database...". The system will prompt you to provide information about "Database Name", "User Name" and "Password". Please note it will give you a "Database Location" as well.
3. The "Connection" to the created database will be added to your environment automatically. For example, you may see this connection information.
"jdbc:derby://localhost:1527/[your db name]"
Case2 : use the separated installed
The database location:
By default, it is a folder that you execute the command to start the Apache Derby. Later I will mention how to customize.
The database version:
Regarding to my previous post, it is a version 10.6
The new driver registration:
Since the default driver is version 10.5.3 as I mentioned above, the version 10.6 driver should be registered by the following step: -
1. Go to "Services" --> "Databases" ---> "Drivers"
2. Right click at the "Drivers" node, at the pop-up menu choose "New Driver...". The system will prompt you to provide the following information:-
"Driver File": The full path to the "derbyclient.jar", by default it is in [Derby_Home]/lib"
"Driver Class": The will be selected automatically by the system, Anyhow you are allowed to change.
"Name": The display name of your new registered driver.
The database creation during the connection is performed:
1. Go to "Database"
2. Right click at "Database"node, at the pop-up menu choose "New Connection...". The system will prompt you to provide the following information.
"Data Input Mode": I prefer choosing "Field Entry". If you have an experience about it, you can prefer "Direct URL Entry".
"Driver Name": Choose you previous created.
"Host": I prefer localhost
"Port": I prefer default port 1527.
"Database": The database name. Please note, if you provide only name, the database will be store at the default location. Anyhow you can specify the full path to your decided location. For example
"c:/[My_Location]/[My_DB_Name]"
"User Name":
"Password":
"Additional Props": I prefer "create=true". If you have any any additional property, it can be separated by comma ",". Please note, this option will create the database automatically along with the specified user name and password respectively. If the database is crated once, this option will be ignored.
"Show JDBC URL": I prefer to check this checkbox and copy the JDBC URL for further using, such as the database management via the "SQuirreL SQL Client" or other tools.
3. Click "OK" when you finish,the system will create the database if it is not exited. The system will prompt you to provide the default schema, at the moment please choose "APP".
At the moment you have finished creating your own database. The next post will take you to create tables. Please stay tuned.
ไม่มีความคิดเห็น:
แสดงความคิดเห็น