How to open the java application with database to another computer - java

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.

Related

Managing Java based Desktop Applicationc(Database Management)

I am developing a Java based desktop application for a school.
As I am beginner, I am facing some issues.
Where to store the data of students or teachers (In files or database )
If in files, how I will ensure the security ?
If in Database, Can I embed db in application or I need to install db on server.
If db is installed on server, how I will manage the application if I will give that to other school users. (Means distributing the application to different users)
Do I need to create separate database for different users on servers or Can I make separate schema on same db.
First of all you need Mysql server installed for the following:
1->Store it in Database(mysql database)
2->database security (refer mysql secuity)
3->all you need is mysql connector for java put in the application folder of app you are creating
4->You can provide database inside of folder of application no
5->You can add user in same database.
You could do this:
1.Where to store the data of students or teachers (In files or database )
If you would like to go with open source databases, go with MYSQL instead of storing in files. Basic user authentication is enough to give you security to get started with your application. So no need of 2nd.
You can install and run on a remote system or your local machine depending on your application requirements and budgets.
On top your database, to communicate with it, develop a Spring web application (Spring data jpa) with REST web services so that any user can communicate with your application.
In your data base, you can manage users as well with basic authentication like username, password.
No you need not create separate schemas or dbs for each user. Instead you can create a single table that has information regarding Users for your application. For example, create a table "User_Management" which has columns like emailId, phone, name etc.
To get started, you can refer below:
http://javabeat.net/spring-data-jpa/
You should use Database (the best for this is Derby DB default for Java)
You can Embed Derby DB in application and also use this as server client.
Derby DB is light weight 2MB.
Alternatively you can use MySQL
If db is installed on server, You would create server on other school's PC or
you have to purchase the online server.
The Best as I described is Derby but if you want to use other you can use Xampp , Wampp server for local server client applications.

Java Application Deploying With SQL Server Database

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

Derby access in IntelliJ?

I'm trying to learn the basics of database access, and I chose to use Derby. I'm using Embedder Derby, and I have IntelliJ set up so that it connects to Derby. However, when IntelliJ is connected to the database, my applications cannot access it. I know that I have to disconnect from the database from IntelliJ before attempting to access it with my application. Is there a way to set it up so that I can access the database with both IntelliJ and my application at the same time?
You cannot access the Embedded Database from more than one process, because when you run the Apache Derby database in embedded mode, only one Java process is created. The database process becomes an integral part of the process in which it was created.
However, you can use client/server mode to access the database with more than one application.

Android app extern database server

When I want to create an SQLite external database for android application, do I have to have a server with database that is always running?
Yes, since it will be on a server. If the server isn't running, then your application won't be able to get any data from the database.
There's a very important distinction that we're missing here - what it means to have a remote database.
SQLite is a flat-file embedded database engine. You don't have a separate process running SQLite in the background like you would one for MySQL or PostgreSQL or Oracle, nor would you really want to - SQLite as a database is pretty limited in what it can do.
If you say that you're going to have a remote SQLite database, then that implies that you have some server somewhere that writes to and reads from this flat-file database. If you can finagle that somehow, and make it secure, then more power to you - and yes, you could have this accessible remotely for your intents and purposes. Trust me though, you wouldn't want to.
What you're likely looking for is a way to remotely run MySQL or PostgreSQL instead, as these are proper database management systems (DBMS) which will be able to both service remote connections and give you a more expanded set of the SQL language.
Ultimately though, the database server must be running at all times. You wouldn't be able to connect to the database if it's down, and you don't know the lifespan of the app (or when it's going to be accessed, etc).
i got the below information from SQLite home page
SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.
Based on the above statement you don't any server. I hope this information is useful to you.

Why h2 and mysql database locations are different in eclipse?

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.

Categories

Resources