Problems with .sql(script files) and .properties files. [Using Netbeans]
posted 4 years ago
Problem 1 I was told to create a Simpledatasource class to connect to the database and this class makes use of a configuration file called database.properties which stores information about the url, username and so forth in a simple text file consisting of key/value pairs such as:
We were also told to write a program to test the class, which is also from horstmann.
This was my test code but it didn't provide the right answer. the output was meant to be a name called romeo. I dont know what i did wrong need help here please
we were told to make a new class called databasegenerator which has a main method(). and it should make use of the simpledatasource class to connect to mysql database. the generator should read all the sql statements from the database.sql script file and load them in the database.
I'm not sure if my script file is correct for this is what i did. I just wrote all the sql statements into a notepad file and saved it as database.sql and this is the statement.
My problem here is i dont know how to connect my .sql file to my databasegenerator class and also i'm not sure if it works because i got a code from this site which i tried using but i got errors, i guess i might have done something wrong.
heres my databasegenerator class code.