Java Data Base Overflow? [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
My code is simple, it generates a Data Base to store certain data (obviously), but the problem resides in the fact that it would create an "overflow" of DBs becuase every time the class ran it would generate another Data Base, I heard of a command:
CREATE DATABASE IF NOT EXISTS insertYourFavoriteName;
But some people say that why should I need a DB for each computer, when I could just do a central one when users conect, but correct me if I'm wrong, that would make the app depend on internet, right?
So in resume here are the 2 questions:
Does the command mentioned above works? Or does a better version or way to work around it exists?
Data Bases where all users connect to it mean that you need a server, and as a consecuence your app would depend on internet?

If you want to learn about databases you practice basic CRUD operations on that database. After that do some sample applications on database
If you want to create a database if not exists in mysql simply use this CREATE DATABASE IF NOT EXISTS DBName;
Basically before checking all these things you have to have basic understanding of what is database and how it works, So, please go through some good resources and get good understanding on the concepts.

Related

How to share a Java Project with a JDBC and a SQL connection? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed yesterday.
Improve this question
I made a french conjugator GUI using Java. I also created a SQL Database which had all the french verbs that users could pick and choose using SQL Workbench and connected it to the project.
When I tried to share it with my friends, they were able to access the Java project and see the various GUI elements, but none of the conjugations came up. I shared the database as well exported in the .sql format.
What can I do to fix this problem?
Probably you are using a data base like MySql or PostgreSQL .., like that all of your friends need to install this data base into their machine and have the same configurations as yours.
The first solution (simple) is to use an internal data base like : JavaDB,
SqlLite .
The second solution is to put a script that will be run within the
first execution of you Desktop application / the installation of your
application, this script will downloed the DB use and configure it,
create the tables and do the Job.

can i build a java desktop application without sql knoledge [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
i am not a pro with programming, and i'm trying to build a desktop app with java, but i need to combine it with sql in order to store a lot of info in a table (database..)
and when i googled i found hours of tutorials to learn sql,
i'm still struggling with java and i have no time to deal with sql too...
can i do this without learn the sql language and all...?
do i have to sit down and study it all or is there another way around?
(p.s. sorry, i think my english not that good...)
Well there's some options:
Use files instead of a database. You can make use of serialization to store your instances directly on files.
Use a non relational database so you won't have to deal with learning SQL
Use an SQL database but search for an ORM. ORMs let you interact with relational databases without typing SQL directly (but you can if you need to when necessary)

Do I have to create a new database? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I use Netbeans and the services that allow me to create a mysql database. My question is, when I finish my project will the database be of use? Or do I have to create a new database?
If you didn't get the question right here is a complete description of my question: Is the inbuilt database only used during the building stage of the project? Or can I still use the data created in the database, with the same code? And not have to create a new database?
No need to create database again. When you configure the database server you are basically creating a client connection for your database server in your IDE. So it's not IDE bound, which means you can use the same database.
I guess you can use the same database you created before.
Netbeans creates the database at first stage when you are creating the model. But once you do it, you can reuse it by just accessing with the own credentials. Perhaps would be great if you can elaborate a bit more.
What kind of databse are you refering to? Mysql, oracle, postgresql?
May you attach an screenshot of what you are doing in netbeans?
Hope this could help so other people can understand in detail.

What is the best way to save a lot of links? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am working on a program which gets all links from a website to use them later on. I am using the Java library JSoup to get the links form the website.
My problem is that I don't know where to store all links for later use. Every link has some attributes like "used" or "not used" and the date when it was used. It should also be Windows and Mac compatible. The saved data should be updateable, editable and the program should read the file where the data is saved fast.
Does anyone know a way to solve my problem?
Edit:
As my question wasn't clear for everyone here's a simpler question:
Should I store the links with their attributes in a database or in a file?
If you need to store on a single file I'd go for SQLite. It's a SQL database provider that can save a whole database on a single file. SQLite databases are universally portable.
EDIT: As #bigdestroyer commented, Apache Derby is pure Java and may be another interesting option for you. I haven't used it though, but there is a nice comparison here.

How can I create Database and Tables within a Java application? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I would like to create a program in Java, that manipulates data and saves them physically on disk(in text file). I would like to create a simple program that allows you to insert a course, edit it, delete it. The program is stand-alone, so I would create an internal database in the application, create and save various tables with data on the user machine's, so that I can use the program on any computer.
How can I do it? I tried to take a look in the forum, and I found that Derby or HSQL can do these things; I tried to read the documentation and do some testing, but I just can not understand (I'm at the beginning), where data is saved? in which file? where tables are created?
If you can give me a help I would be grateful, even with a few simple example of creating a database and a simple table.
My question is: I would my program (executable), had within the structure of the database, and on each machine where I run I can insert, edit, delete a course, then create the various tables on the computer that I'm using. How can I do it?
Thank you so much for your patience and for your help.
You can do it easily.
The general algorythm will be the following :
start program
test presence/connection to database => ask to create a new database if file backed, or ask for a new connection
test existence of tables (exception on a simple select) => launch table creation commands in JDBC (*)
normal processing
(*) my create tables script generally begin with DROP ... IF EXISTS to start from a clean place
just to start as a beginner create a program and save that data in any .txt file with java code using filing. make sure that make your classes serializable. and then you can get, edit and delete from that.

Categories