This might work for you, sure. I'll be a little more complete for future readers of the question though:
but a lot of the queries you write might be database specific, or rely on certain keywords to be effective. Take for example a common query. You want to list all the products in a database , but show the user 10 at a time:
MySQL:
select * from products LIMIT 0,10
then for the next 10 rows:
select * from products LIMIT 10,10
etc.
Fantastic, so users can use MySQL for the database. Well what if they are using postgres, another free and very popular database? That query isn't going to work:
SELECT * FROM product LIMIT 10 OFFSET 10
So your code isn't portable as much as you think.
One way to get around this is to create your own interfaces (interface Query, interface Access)for all the queries/accesses that you plan on doing, and then have a query factory which can instantiate, based on the DB Dialect (MySQL, postgres, etc) and create MySQLQueryImpl and PostGresQueryImpl (both implementing the Query interface).
You have to code some of the database calls twice, unfortunately, or move them out into a properties file themselves. You can also design the query factor to instantiate from a property file (like you originally want), and allow other users in the future to implement their own Query so the extensibility is there, and you don't have to do it all yourself.
Or...
The other option, which is probably more elegant and error proof (well... maybe) is to let someone else do this for you. Hibernate is a very common tool that abstracts out the database read/writes for you, and can be configured to use a different database just as you want to, only it has years of experience and bug fixes. It's not the easiest thing to learn (for complex queries and joins, etc) but for the basic models and mapping to a database, it will give you everything you want and more, including the ability to turn on/off caching very easily and lazy loading of data so you don't bring in thousands of records that you won't use.It would take you a long time to create and harden a system like this.