File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Problems with .sql(script files) and .properties files. [Using Netbeans] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Problems with .sql(script files) and .properties files. [Using Netbeans]" Watch "Problems with .sql(script files) and .properties files. [Using Netbeans]" New topic

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

Emmanuel Onah

Joined: Nov 16, 2011
Posts: 2
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 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

I agree. Here's the link:
subject: Problems with .sql(script files) and .properties files. [Using Netbeans]