sql - Few questions from a Java programmer regarding porting preexisting database which is stored in .txt file to mySQL? -


I am currently writing a library management Java app, and so far, the main library database is stored in one The file was changed to .txt file which was later converted to ArrayList , to create and edit the database and again to .txt Save changes to the file. In fact, a very ancient method is, in fact, being heard later on SQL, I am considering closing mySQL to the already existing .txt database. Since I do not know exactly how SQL and how specifically my MySQL works, except for the fact that it can communicate with Java code. Can you visit / buy any book / websites from me? First Book Head First with SQL? Especially when using Java code to interact with SQL database? It should be noted that I am already resting with using the third party API.

View from 30,000 feet:

First of all , You have to find out how to represent text file data using proper SQL tables and fields. If your data represents a single library record of various SQL data types, then you will only need to create 1 table. This is definitely the easiest way to do this, because the conversion will be able to work by line-by-line If a lot of data is duplicated in records, then the most appropriate way to create multiple tables is to duplicate your database data Do not be. Then you can add these tables together with the ID.

When you decide how the data is divided, you create a MySQL database, and within that database, you create tables (there is only a database that has several tables keeps). Connecting to your MySQL server with the console and creating databases and tables.

Once you have created the database, you have to type the code to access the database. Shows how to use JDBC in an easy way to connect to your database. You then perform a query to create an statement object using that connection, inserting, updating, or deleting data. If you are selecting the data, you can get a ResultSet back and see the data. To use JDBC, select and use data from ResultSet .

Your first code should probably be a Java utility that reads the text file and incorporates all the data into the database. Once you have the data, you can use the main program to read from the database instead of the file. Will be able to update


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -