If you've already implemented your DB connectivity code then I think the optimum solution will be somewhat dependent on how you've done it.
The basic idea of a class factory is that, based on some information you supply either as a parameter or through some kind of configuration, it will manufacture that right kind of object of a given type.
If your database code (SQL & JDBC) are completely platform neutral then the only differences between databases will be the JDBC Driver and the connection string. You can abstract this further by using a javax.sql.DataSource (a Connection factory) with JNDI.
Otherwise you'll probably need to map your DAOs to the appropriate database, say in a properties file, and create a factory class which performs the lookup for the requested DAO, creating your object with something like Class.forName("com.myorg.myapp.dao.MyDAO").newInstance().