I have developed an application which works with derby database, all things are ok on my machine, i started the database server from the netbeans.
Is there any method to copy the database structure and data for distribution to my clients?
All you need to do is to copy the contents of the database folder as is.
The database directory consists usually of one file service.properties and two directories: log and seg0.
If your application is the only one accessing this database on the client, then you should consider to use embedded mode, to avoid the installation of the Derby network server.
Related
Should I do the "Embedded Database" if I want the program I created with the database to be able to access another computer?
I finally export my Java application as an executable file/application file, but my only problem is that its database needs to be always connected to the database I created. So, when I run it, It runs perfectly but I cannot access my database unless the NetBeans is running in the background. But I want it to be able to run independently without NetBeans and needing to connect to the database every time so that I can run it to my other computer. I read that I should create an embedded database so that when I try to open the file to another computer, the database is included.
Is my understanding right? I created a database using JDBC.
if you want to connect to your database in other computer,you'd better create your database on Server which connected to the Internet.
It depends on the type of application which you are going to develop.
If your application is a single-user standalone system then it's perfectly fine to use an embedded database. Example: Single-player game.(In here application's database is hosted within the user's machine so other users can't access those data)
But if you are developing an application which is having more than one user and those users need to share their data with others then you should go for a database like Amazon RDS which is hosted on the cloud, because then you can share those data among all the users.
(Ex: Microsoft Teams Application)
Finally, I should say yes you don't need to have NetBeans working if you select either one of those options.
I developed a java swing application by using hibernate connection and MS SQL server for database. Application is working fine. And I know the way to create and EXE and the installer for application.My question is, how I install this application to another computer with database. Should I install the SQL server on that computer or is there any way to use the db without installing the whole SQL server in that computer.
As far as i know there is no way of using database without installing the SQL Server, unless you configure in a way that the application will communicate with the db on your pc, but that's complicated
A different approach to this would be for you to make a view in the database and extract the data you need to a csv file, include that file in the resources folder of the application and then use Lucene to query over it
Take a look at how to get started: here
When you need to update the data in the file you can release updates for the application that would include these changes in the csv file/s
Recently, I constructed a java application that uses JDBC in order to connect to mysql. The question is this: if I export the java application as a jar file, does the database itself gets exported with the jar file? In other words, can the application still connect to the database (mysql) on any pc?
No you can't, JDBC is an API that defines how a client interacts with the database, it's a separate thing.
This is a stupid question and I know it, nevertheless I'd like to understand how these two databases are handled within my system.
I have eclipse IDE with two projects: h2_test and mysql_test, where h2_test is configured to use h2 database and mysql_test is configured to use mysql database.
In h2_test I have h2 location configured as String url = "jdbc:h2:~/h2_db" whereas in mysql_test as <property name="url" value="jdbc:mysql://localhost:3306/mysql"/>. As you might have guessed h2_test is a normal java project and mysql_test is dynamic web project.
When I run my h2_db my h2 database instance is created on my hard drive at ~/ directory.
When I run my msql_db my mysql database instance is created in memory?
I must add that to actually run mysql I had to install it and run as a system.service while for h2 all I had to do is to connect a h2 driver in eclipse. Why so much hassle with mysql?
Why I can't use the same logic with mysql db and create is as jdbc:mysql:~/mysql_db?
How are these set-ups different and which one is preferable for a web application?
h2 DB is a standalone database, that a single Java application loads directly and operates on. Usually, a single application can use a DB at a time. Other DBs of this sort are the key-value LevelDB and Java's DB4O.
MySQL, on the other hand, is designed to be more powerful, in that it is run in a server process (written in C++). Applications (a large number simultaneously) can connect to a given MySQL server (with authentication), even from different hosts.
I want to ask best server for a simple desktop java application.
Please suggest me a server using which i can port my database files on another computer.
can i have an option of MYSQL server 5.1.
in which i develop my application and then i can easily port it to another computer as it is with database.
Not really sure about your application requirements, but for simple application look at embedded databases like Apache Derby.
MySQL and really any other database are also quite straightforward to transfer via data dump/load. In case of MySQL even the data files copy will work.