How to create and use a database in java [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 9 years ago.
Improve this question
I have developed a Java GUI application which uses a MS Access as database. But, after my research I came to know that it can only store 2 GB data. Now I am planning replace it with some other database.
Which is the free and easy to use sql database?

Java connectivity with MySQL DB:
http://www.vogella.com/articles/MySQLJava/article.html
Step By Step Explanation: http://www.roseindia.net/jdbc/jdbc-mysql/MysqlConnect.shtml
Apache Derby:
It is Relational Database similar to MySQl developed by Apache.
Tomcat Server
As name says, it is a server, which listens to request on particular port, process dynamic request and respond back to client.

download mysql and use it. you can download from here

I would think of Apache Derby as a database used mainly for testing purposes, and I think it can only be accessed by a Java application.
Therefore, I recommend MySQL as a free and easy to use SQL database.
IMO, MS Access is not a proper database, it's a toy database.

You can use MySql database.You can download it from here.You will need a JDBC driver to connect to MySql which you can get here. If you are using Java 7 then JDBC 4 will already be present. Just put the driver jar file in the class path. It will automatically be picker up. No need to do need to do Class.forName("someDriver");

Tomcat server is a web server to run java
You can use Mysql database or, sql server database,....
To use mysql you can read at here:http://dev.mysql.com/doc/connector-j/en/connector-j-usagenotes-connect-drivermanager.html

Related

Create a database in IntelliJ IDEA [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 have to create a database having the name Cars using any RDBMS (Oracle, Postgres, MySql, Java DB, etc.).
Then I have to create a user with the name "dbus" and the password "uspass"; and 2 tables.
Can any of you explain to me how I can create a database in intellij? I can't find any options.
I read somewhere that I have to download a database browser, I downloaded it and I don't think I can create a new database. As far as I understand, this "db browser" only establishes a connection to an existing database.
I just want to create a database where I can create some tables. Then with the connection I hope I can handle it.
For most data sources you have to provide the URL of the existing database where you can create tables, etc.
The database needs to already exist and you should use the administrative tools for the corresponding RDBMS to create a database and a user first. Only after that you can connect and work with this database in the IDE.
As far as I know, creating the database directly from IntelliJ IDEA is possible only for the Embedded Apache Derby data source:
P.S. Database plug-in is available only in IntelliJ IDEA Ultimate edition. And same functionality built into their separate product, DataGrip.

How to sync data from a local database to a remote database [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 7 years ago.
Improve this question
I have a java application that collects data (such as login user, logon time, ...) into a local database (probably a Derby database or similar). This application will run on several PCs (windows XP, 7 ...). I would like to collect all data from each PC and save into a main database that reside on a remote server. Then a web application could display the results and statistics for all PCs. The local database is important as we need to collect data even if the link to the main servers database is down.
I would like to be able to push the data from each PCs to the main database. (notice that this ideas come from the splunk application where log entries are push from local applications to a main server).
How can the java application of each PCs communicate with the main database. Any good examples are welcomed?
Is it possible to use some HTTP request (json or rest) from the local java application to send the data? If so, how can this be done (examples)? What is needed on the local PCs to accomplish this?
Any better ideas or suggestion are welcomed.
How can the java application of each PCs communicate with the main
database.
Whatever method you're using to communicate with your derby database will be the same to communicate with your remote database. Typically this would be done with JPA or Hibernate or a similar ORM library.
See: http://docs.oracle.com/javaee/6/tutorial/doc/bnbpz.html
Is it possible to use some HTTP request (json or rest) from the local
java application to send the data? If so, how can this be done
(examples)? What is needed on the local PCs to accomplish this?
For this you'd want to investigate JAX-RS which is the java standard way of communicating with restful web services.
See: https://jersey.java.net/documentation/latest/client.html

Java application integration with a server and Rails? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I have just finished production of a java application that scrapes a website, takes information such as prices and names from it, and sorts the data. The data is then stored in a server. A colleague is then going to use ruby on rails to extract the information from the server that my application has stored, and display it to the user. In this case, what would be the most useful tool to place my application server-side and make it continuously running? Would JSP or the use of a servlet be the solution? Sorry for the noob question, my background is OOP and this is my first web-based project. Thanks for any help!
EDIT: The server is an amazon web server which uses a PostGreSQL database.
Your question lacks some information.
Who is the "server"?
Is it just a machine connected to the web and you stored data files on its hard-drive?
Is it a daemon running on a machine, such as database servers or ftp server?
How do you store the data on server?
If it's files on a machine I can suggest using Apache web server on that machine to gain access to resources on your "server machine". Another idea is installing an ftp server on your machine. It will grant access to a declared part of the machine's file system.
If it's a database (whether SQL or No-SQL), all databases have the server side program that runs as a daemon and is accessible with database connectors through the machine's IP address and the port the DB uses.
Another option is, as you mentioned, using an active web server, such as Apache's Tomcat. This way you can run a web application (html/jsp that use your java project) which will provide an easier access to the data for your colleague. For example, the web app can extract the needed data and export it as json or xml or plain text.
Then your colleague will have the ability to access your stored data with his web-application written in ruby.

Which is the best database application to work with offline data? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have one requirement as create a desktop application edition of one data-driven web application. This web application is currently running on MySql database.
Now as per my requirement I need to create a desktop edition which will be downloaded from the web-application along with data file and it can work without Internet connection on Windows and Mac platform.
So now I cannot use MySql here as it needs connectivity with database server. So my question is which is the best option now to use as database in my desktop edition which can be used with offline data file without any server application? Also it will be plus point if migration from MySql to that database take minimal effort.
Here are some considerations to be taken in consideration:
It should be capable of storing blob data.
It should have almost same sql structure as MySql
It should support ORM framework like Hibernate
MySql data can be transfer in its compatible structure.
Please suggest me the best option for this.
Also this will be Java based solution so I am planning to use JavaFX as UI framework. Please suggest me if there is another better option for this within Java.
You can embed the following databases (among others) quite easily in a portable application:
H2 Database
HSQL Database
Derby database
It's common practice to use one of these by default, but also allow users to configure there own database. So if they wish to use their own mysql database they have that option.
Stack Overflow Similar question answered here
These embedded databases allow you use JDBC, JPA, Hibernate so you could properly use the same database communication/transaction code as it were on the web app server endpoint, except for new requirements though... Personally, I prefer to use HSQL DB.

Oracle Database Deployment [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 9 years ago.
Improve this question
I created a table in an Oracle database on my personal computer.
Then linked it with a Java Application and I am using that table/database to save all the data from the application.
But when I deploy my .jar file and run it from another system, that database is not installed on it.
Can anyone please tell me or guide me what I am suppose to do? In order for the database and the application to work on other systems too.
Thanks
Basically, you'd need some options in your program to allow the user to configure which database server they want to use.
It would be up to them to deploy a server and provision it correctly before they could use your program. Instructions on doing so would be included in the setup documentation for your program.
It's also possible for your program to be able to setup a database on a remote Oracle instance automatically. You would implement an option to allow them to CREATE DATABASE on a configured Oracle instance, which would run provisioning scripts to create all the necessary tables, views, sprocs, etc.
Since these steps create a lot of friction in deploying and using your program, you should also ask yourself if you really need a SQL database for your program. If it's just single user with a small amount of data, you could check into some sort of local DB that runs in proc.

Categories

Resources