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.
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 have developed a REST web-service in Java interacting with a MySQL database.I want to deploy the web-service and the create a database at a server so that I can invoke it from an application.I tried Microsoft Azure but was unable to get it done.Where can I find relevant information for this?
I had similar problems with a MySQL database using the third party option in the Azure Marketplace from ClearDb. What I ended up doing was switching my database from a MySQL instance to an Azure Database Instance (Subset of SQL Server's features.) This worked perfectly for me! I was able to query from my database feed data to my api, and access the API through my Azure Web App.
I understand this may not be an option for you, however, Digital Ocean is a great cloud hosting option (with scaling similar to Azure, although not as good in my honest opinion.) You can set up a Linux Environment with a MySQL Server and JVM and serve your whole API through there. Best of Luck!
#coderden, According to your description, I think you have been deployed your Java Application on an Azure WebApp. Then when you created a MySQL database on Azure for connection from the Java webapp, please make sure the webapp & mysql instance created in a same resource group and note the connection string of MySQL on Azure.
As reference, please see the article to try again although it's for PHP, the steps are the same for Java.
I have a Linux server which has a Database. I want to query the Database from my Android application.
All the tutorials I find tell me to use PHP for some reason.
Can't I just query like I would normally with a Java application? Which is, I connect to the Database then send my queries as Strings.
It seems I need something like this:
Why?
PHP is just a server-side programming language. You can use any language and any server. The main issue is
Can I Query MySQL Database Directly from Android without a Web Service?
Yes you can. Just open the port where your MySql database is set usually at 3306. You also need JDBC Driver to set up connection to it.
Should I Query MySQL Database Directly from Android without a Web Service?
Unless you want to make a Database Client app (like phpMyAdmin) where each user holds his own credentials then you should not. In such case everyone will be using their own credentials to access their own db. In your case, you'd be hardcoding your database credentials in the app for everyone to access.
Well, your database user is only allowed to connect from localhost not from the outer world. If you want to execute queries from outer world then you will have to allow access from all IPs i.e. You will have to create a user create user 'app'#'%' identified by password123 (In my opinion it will be a bad approach).
Moreover you can build REST Web Services either using PHP (Recommended) or JAVA to interact with the database without opening it to world wide.
I want to create a Desktop App(Software), preferably in Java, which connects to a central MySQL DB on a local network whenever available.
I also want it to store and use a copy of the same DB when the central DB is not available, and sync whenever the central DB is available.
How can I store data locally, I mean which kind of database should I use for local database?
Also, are there any tools which speed up the Desktop App development?
Let's suppose that you will implement your solution in Java. You will need some classes (i.e. Data Access Obejcts, DAOs) in charge of interacting with the database on the network and on a file based database embedded in the application (the "local" database).
What you need:
A local database that you can ship with your application like H2 www.h2database.com, HSQLDB http://hsqldb.org/ or Derby db.apache.org/derby/.
To develop your DAOs (using JDBC or Hibernate) in such a way that you can instantiate them with different drivers, URLs, login/pwd and use only SQL standard / functions supported both by MySql and by the local DBMS. In practice you must avoid using DB specific functions.
You can use Hibernate or JPA for example, they have quite a nice and easy integration with your application.
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.