• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems with .sql(script files) and .properties files. [Using Netbeans]  RSS feed

Emmanuel Onah
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

This was my code. As from horstmann's Big java.

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

Problem 2

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.

Please i need help. Thanks

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!