Where is Derby database stored when I create it from netbeans?
How Can I combine it with the rest of my project in one folder?
Right-Click on Databases->JavaDB in the Service View and select Properties...
This will open the following screen, where the location is visible and could be changed:
Related
I am working on an android application on android studio, and I am using a sqlite database. The thing is, I want to change the structure of it, so do I just have to change it from DB Browser for SQLite, or I need to change it somewhere else ?
Because the code I am working on isn't mine, and I am just starting to lear android developement
An option is to change the internal structure of the database file from either DB Browser or command line on your computer and then copy it to your phone's storage when the App is running.
If you don't know the steps:
Step 1: Create a new database file from either command line or SQLite DB Browser with your required structure.
Step 2: Place the file in Assest directory in your Project folder. (Assest directory will be in the same folder as the 'res' and 'java' directories are)
Step 3: On Activity Start event, copy this empty database from Asset directory to your database directory which is generally located at /data/data/your.package/databases
Also you can query ALTER TABLE to add columns (as suggested in comments).
This explains the syntax for ALTER TABLE. It also explains other methods for implementing Schema Changes.
I'm using Database Tool Window of IDEA, and every I create a new project I have to set the data source in the new project.
Is there anyway to set a default data source in the Database Tool Window, so when I create a new project I can use it directly?
You can make the Data Source global so that it's available for all the projects automatically:
I have a dynamic web java project, which needs to talk to a database
i want to include the created database file inside the project, so that i can access the data inside and the db isnt on some server
is it possible to do that? if so, how ?
For eclipse, open view Data Source Explorer and add the database.
I created a java project that uses a database to retrieve, edit, and save data. I finished the project using Netbeans and now I want to create an installation out of the project. To do so, I want to include the database to be installed along with the project. The code I am using to connect to the database is:
Class.forName("org.h2.Driver");
Connection con = DriverManager.getConnection("jdbc:h2:~/localhost/gallerie", "root", "123");
The application is working fine on my pc, but I need it to be installed as an executable on other pcs.
What is the best way to do so?
One way to do this is with the setup packager from stardust software. You will also need to include some script or some Java code to create the database and the database user. You don't need to do that with the installer. Instead, create some file or store something using the Preferences API so the program knows when it is running for the first time. When your program runs for the first time it needs to call some function to create the database user and the database.
Alternatively, you could also package the database files with your application as described by this stack overflow question.
I am working on a java project which has it database in db2 and I connect to database through a common ip , I use the database view perspective of eclipse itself and see the table entries s in eclipse database explorer itself, But I was searching for a plugin in eclipse such that When I click on particular table then a screenshot of it referenced table in form of graph is to be get displayed that shows its references in other tables too..!!
You can use IBM Data Studio that is an Eclipse-based application, with many plugins, including the one that you want.
You can download it for free from http://www-01.ibm.com/software/data/db2/express/download.html (Get Free Tools > Data Studio Full Client)
This is a very good tool to work with DB2 from Eclipse.