So, after hours upon hours of research (a little over 12 hours) I finally found how to create a folder AND a database inside that folder. So, I want to help those who have been trying to do this.
Firstly, You wanna make sure that you have installed the JDBC Driver. This allows you to connect to the database that we will be making later. Keep this in mind.
Secondly, You need to know HOW a SQL Database works. In order to add items to the database, you must first create it and tell the database "Hey, I am taking this info and adding it to you, here are the values, can you do that?" And it will, if set up correctly. If there is EVER an error, it will be caught inside the catch statement. This helps developers pin point the issue and find a fix for the phenomenon. Alrighty. Enough chatter. Lets get coding!
Now, with this code, I will be using JFrames toassist on understanding on how the database works.
This is a simple JFrame with four things: A JLabel, JTextField, and two JButtons. The JTextField is, lack of better terms, parsed as a string as it is taking in text. This wont cause a problem in our database as that's all we are logging. The submit button allows us to "edit" the database and add to it.
Simple JFrame:
Think of this as a way to "interact" with the database per se. So, now that we got that defined. Time to connect to the database. As said previously, we will be connecting to the Database that is accessed inside the computer. The way the JDBC works is that it scans your computer in the directories and if it doesn't find the file, it'll throw you an error from the catch statement. After installing the JDBC, you can connect to the database.
Connect to the Database:
"What if the database that we are looking for with the JDBC isnt there?" Simple fix. If you want to pass this code to someone else (this is scary btw), you can code the program to create the database for you.
Create The Database and Its directory:
SUMMARY
Connecting to a Database using JDBC
Creating a Database that isnt there
Creating a JFrame
Taking data from a JFrame and uploading to the Database
Some SQL Basics
Unfortunately that's all the time I have. I will post part II soon. Stay Tuned :P
Hey! Make sure to tag this in #steemiteducation. Nice work man!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit