Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DatabaseHelper {
- private ConnectionSource connectionSource;
- private Dao<User, Integer> userDao;
- private Dao<Settings, Integer> settingsDao;
- private Dao<Prize, Integer> itemDao;
- private Dao<CulturalCenter, Integer> localDao;
- private Dao<Event, Integer> eventDao;
- private static final DatabaseHelper dbHelper = new DatabaseHelper();
- public static DatabaseHelper getInstance() {
- return dbHelper;
- }
- private DatabaseHelper() {
- try {
- this.connectionSource = new JdbcConnectionSource("jdbc:mysql://85.10.205.173/mydb", "myacc", "mypass");
- Log.d("Connection", "Do we reach here?" + connectionSource.getDatabaseType().getDatabaseName());
- /**
- * DAOS
- */
- this.userDao = DaoManager.createDao(connectionSource, User.class);
- TableUtils.createTable(connectionSource, User.class);
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- public Dao<User, Integer> getUserDao() {
- return userDao;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement