• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

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

Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic