Two Laptop Bag*
The moose likes JDBC 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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problems with .sql(script files) and .properties files. [Using Netbeans]" Watch "Problems with .sql(script files) and .properties files. [Using Netbeans]" New topic
Author

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

Emmanuel Onah
Greenhorn

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 database.properties which stores information about the url, username and so forth in a simple text file consisting of key/value pairs such as:
jdbc.url=jdbc:mysql://localhost:3306/university

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: http://aspose.com/file-tools
 
subject: Problems with .sql(script files) and .properties files. [Using Netbeans]
 
Similar Threads
getting java.lang.NoSuchMethodError: main error! thanks =)
help in assignment please! =)
a few general questions
derby Databse connection
Error when executing project on JCreatorLE