Store MySQLite Database Online - java

I'm making a voting app in Java using Eclipse where the user votes for their favorite team. Right now I have a local MySQLite database that I am managing with the MySQLite Firefox extension. The votes are stored in the MySQLite database, then I have another java application that reads from the database and outputs the name of the team that got more votes. However, I would like to store this database online, so multiple people can vote at once, then the results are displayed. How can I go about doing this? I am guessing that I will need PHP, but I am having a hard time finding a tutorial on how to integrate a MySQLite database with PHP. I pretty much just need to store my database online. Everything is functional locally.

Maybe I'll need more details but I'm assuming you have wrote a Standalone Java app, which is connected to you local SQLite Database.
Also, I think you don't want to distribute that app for everyone who wants to vote (would be better if they could vote via a website, right?).
In this case, you have to write a web application to provide both front-end and back-end of your app. You can pick one among many existing languages and frameworks (PHP is one of them), such as Java itself with some web framework, Ruby on Rails or Python/Django (just to depict some of them). Plus, I'd recommend you to use some other database such as MySQL or PostgreSQL.
Here are basic tutorials to you follow for some of the previously mentioned languages/framework:
Java (JSP)
PHP
Ruby on Rails
To deploy you app (i.e. put it online, you'll need a server). Honestly I'd recommend you to use Heroku because the deploy process is really simple (just push your code using git) and you can run your app for free (if your app got really successful you may have to scale up the server and then you'll have to pay, but maybe that's not the case, right?).
So, pick up a language and framework, write your web app and deploy it to the server. Then you can have multiple access voting into the same database.

Related

Connection and storage

I want to make a website done in Java language. This is for my own learning purpose. Since I am doing things myself I tend to get confused.
If there is a Login Form wherein a huge number of people all around the world need to feed their login details and that data gets stored.
To achieve this, do we need to have a database hosting?
Can you please guide the exact steps for this?
I know Core Java and MySql Database Basic knowledge but I have not done both app connection procedure.
I only know to code in Java and SQL queries. I had done an earlier basic application that runs only on a system (This was done in VB.NET and MySQL).I did this a decade back. Now that I am back to programming after a decade, I am bit confused about how to make this connection in a way that the Login form stores the details from the website to the database. The database should be MySql or some data hosting site? I will be trying this out on Windows System in Eclipse Neon. Let me know if you need further details.
Now that you are well versed with Java and MySQL, you can learn about Apache Tomcat and Struts 2.
With these, you can make an application that serves your purpose.
At the front-end, you'll have jsps with the login form.
With struts, you can map actions (like button clicks) to java classes. In these Java classes, in the backend, you'll have the code to connect to DB and store data.
Hope this guides you make your web application. :)
You don't need a database hosting but you need a database server configured properly at your system for localhost development.There are many sites guiding you to make a full java app using jdbc and jsp step by step you can get there easily.They will guide you to configure your database server.

Synchronizing web, mobile and desktop apps using SQL database

I am currently researching and developing an application in Java for the desktop along with a Java applet to embed inside a webpage and I am using C# to develop an Android and IOS compatible app. (I am open to using other languages, these are just what I have started with and feel the most comfortable with at the moment).
I have it so that the user can use any of the 3 environments to enter a post which is then stored in a database.
How would I make the various apps sitting on each of the platforms pull the new post down from the database so that the users can see it on all three platforms straight after it has been added to the database.
I assume that the applications would need to be looking in a specific table which is owned by the admin who is logged in and doing the posting and then as soon as it sees a new post it could send a query to retrieve it. These came concept would need to be implemented to updating and deleting posts also.
I am new to this type of cross-environment development and wanted to ask for advice. Thank you for any help. I have tried to make this question as specific as I can considering I do not have a particularly specific question in the first place.
Any advice about how to go about this task will be greatly helpful.
Thanks.
One road you could take is writing a simple web service, maybe using a high-level interpreted language, such as Python or Ruby, to provide a RESTful HTTPS backend. That way, all applications could query this web service, data would always be in sync, and you could have multiple front-end interfaces.
This seems like a trend nowadays, lots of multi-platform applications are structured as smaller micro-services on the back-end. And it really makes sense sometimes, because you get a lot of less coupling between parts.

Database for Google App Engine and desktop application

I need some advice. I'm new to Java EE technologies. Anyway, I would like to make my first JAVA EE project.
Imagine 2 client applications and server application.
1) Server. I picked up Google App Enginge technology to create server application. I would like to connect it to some easy database.
2) Client applications. I would like them to be desktop applications (or applications launched from the desktop) and these 2 apps also have to be connected to the same database as sever.
There was no problem to create this in Java SE environment - I had two clients applications with sockets staff and server application with socket staff. All worked locally.
But now I want to have server and database on the Internet and I want to make it in more professional way.
My problems are:
How to create free database from GAE? Is datastore the best option or something else? What's important - the client desktop application will also use this database. I'm looking for the easiest solution.
Maybe the solution is to create web client application instead of the desktop one - but make it look like it was desktop app (I would like to avoid using browser). I have no idea how to do this and if this is even possible.
Any help will be really appreciated. I'm stuck because my knowledge is too little to start. I have ma GAE app and I don't know what should I choose next.
Thank you in advance.
If you want make desktop application, you need to build backend application first.
check this out. You can use same concept with that. Build back end, and then create API to connect to your backend, and use that API in your desktop application.
Datastore is easiest way to store data. Check this out. Datastore have some limitation (such as didnt support join, many to many relationship, etc). Please consider wisely. Otherwise you can use Google Cloud SQL for your option, but AFAIK its not free.

Java DB Client-server technology - centralized DB - How?

I have a project this year. It is about developing a Java application with a database for sharing and validating documents between the manager, secretary and head of finance.
My question is: How to make the database accessible by all, since the application will be installed on computers that I mentioned above, do I have to install it (the database) on these computers? The constraints of consistency and integrity of the database will be violated. The users will not have the same copy after each update!
Is there a possibility (or technology in Java) to put the database on the web and there will be accessible by all, or make it accessible from a computer that I realize as a server (client-server).
I would be grateful for your help or giving links for Tutorials.
How to make the database accessible by all, since the application will be installed on computers that I mentioned above, do I have to install it (the database) on these computers? The constraints of consistency and integrity of the database will be violated. The users will not have the same copy after each update!
Your question suggests that you will need one database on one computer. Let's call it a DB computer. I'd suggest this be a server, that no one from regular staff, such as secretary, manager, etc... can access.
Having one central database will eliminate your worries about integrity violation.
Now, you have two options. You can make a web application that your users will use to interact with your system. This is a more modern approach, since you'll have a 3 tier system:
users will access your application via a browser
the web application itself is stored on an application server, and it is accessing the database
the database is the backend part
The second option is making a desktop application and deploying it to everybody's computer that will use it; and afterwards making it connect to the database for interacting with it.
The first option is easier when you want to expose your application to a large number of users (and to the web), but know what you're doing when doing stuff like this, since you have to take security very seriously.
If you go the first route, you will need a few things:
First, a database. Use what you can, but if you need free and high quality databases, use PostgreSQL or MySQL.
Second, an application server. I suggest using Tomcat or GlassFish.
Now, you need to develop your application using JavaEE. There is a wealth of information about this, so I hope this will help you in the beginning and point you in the right direction.
Note that Tomcat doesn't support Java EE fully, but a subset of it. And this subset is surely more than enough for what you need to accomplish.
If I understand you correctly, you are looking for ways to implement a client-server system, where several clients on distinct computers each connect to a central server (or cluster of servers) hosting a DB. In Java, usually (but not necessarily) the DB is inside a web application, and the clients are lightweight web clients - in this case it is usually called an enterprise application.
Java has a whole dedicated SDK for this, called Java Enterprise Edition. You may find many questions dealing with this on SO, here are a few which I think may be especially helpful:
Is the offical Sun Java EE tutorial the best way to learn how to make Java web apps?
What to learn for making Java web applications in Java EE 6?

Framework/Platform Selection?

So...I am creating software for a university. The purpose of the software doesn't matter. What I do need to know is, the best way to make it, and what technology to use.
The software needs to be able to accept multiple data sources, from Excel to SQL. However, the students will be using it primarily, and they won't always be on the schools network. I don't know if this should be created as a Web Application, or an app using Java (or something similar). Also, the students are going to need to be validated to use the software according to their current student status.
If I do this as a Web Application, and have it run off of the schools server, is this a better idea? Only thing is, this would require a lot of testing on their end as well right?
If I did this as say a Java program, can this even be done?
-Scott
If you want to use this application by students outside of schools network than a web application is the only viable option. If you will develop this as a Java program (I assume by Java program you mean a desktop application), you have to install this on every student's computer in school as well as home.
Edited in reply of your comment :
Regarding framework/platform selection, I would advise to develop this in what you know most. A good programmer can develop a good software in a language/framework/platform of which he/she has good knowledge and experience.
I'm assuming that a web technology will be best, because you can access it from any machine that connect to the Internet.
Java EE can manage this. So can .NET.
I'd recommend either one with Spring (Java or .NET flavor) as the framework.
The software needs to be able to
accept multiple data sources, from
Excel to SQL.
Spring will accomodate relational databases or Excel.
However, the students will be using
it primarily, and they won't always be
on the schools network.
A web app will only require Internet access. This could pose some security issues that you'll have to sort out. It's easier if they're on your network, because they're already authenticated as students and authorized to use your app.
I don't know if this should be created
as a Web Application,
I would recommend it.
or an app using Java (or something
similar).
Both Java and .NET can be written as either desktop or web.
Also, the students are going to need
to be validated to use the software
according to their current student
status.
Don't know what your security architecture looks like, but Spring Security can work as a cross cutting concern with databases, LDAP, etc.
If I do this as a Web Application, and
have it run off of the schools server,
is this a better idea? Only thing is,
this would require a lot of testing on
their end as well right?
Can be done. Testing is required no matter what.
If I did this as say a Java program,
can this even be done?
Hard to tell. No requirements, no idea of your capabilities, etc.

Categories

Resources