SQL command Attach

  • Yes, at least when using SQLite, you can use the ATTACH and DETACH statements, for example:


    However, usually it's fine to just establish an new connection to the 2nd database ^^ It's safe to have multiple connections to different database simultaneously, e.g.:

    Java
    Database db1 = getSQLiteConnection(getPath() + "/database1.db");
    Database db2 = getSQLiteConnection(getPath() + "/database2.db");
    ...


    Just remember to close() the database connections if you don't need them anymore.


    If you want to access the world database btw, it's highly recommended to use the built-in WorldDatabase (since there are issues with thread-safety in SQLite). When using the WorldDatabase, all commits are synchronized.
    Example to use the WorldDatabase:

  • Thanks .. just read about the attach in an SQL tutorial and could not find anything directly about that but was going to try to see if that was needed I need a third party UID from the database while using another database to keep track with an event.


    this kind of support makes it fun.. thanks

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!