cancel
Showing results for 
Search instead for 
Did you mean: 

Problem trying to connect to an UltraLiteJ Database stored on SDCARD Android Device

Former Member
3,431

I've been trying so hard to connect to an UltraLite database stored on sdcard Android device. The error thrown is : Error J[-405], cannot create database "/mnt/sdcard/Android/data/Pedido_hh.udb". But I want to connect to that database and it always tries to create a new one. This is a part of the code used :

String dbPath = Environment.getExternalStorageDirectory().getPath() + "/Android/data/Pedido_hh.udb";

    try{

        // Define the database properties using a Configuration object 
        ConfigFileAndroid config = DatabaseManager.createConfigurationFileAndroid(dbPath, this); 
        // Connect, or if the database does not exist, create it and connect 
        Connection _conn; 
                    try{ 
            _conn = DatabaseManager.connect(config); 
        } catch ( ULjException e) { 
            _conn = DatabaseManager.createDatabase(config); 
        }

    } catch ( ULjException e) { 
        Log.e("HelloUltraLite", e.toString()); 
    } 
}

Also I'd Like to know how can I create an UltraLiteJ Database using my PC and then use it on my Android Device.

PD: I'm using SQL Server AnyWhere 12.0.1 and Eclipse y SDK 2.2

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member

Andy Quick says this:

I believe the problem is a permissions issue; the path to the database files should be something like /mnt/sdcard/Android/data/package-name/files/a.udb, where package-name is the package name of the application.

The application looks like it is failing to create the database, and then having to try again each time.

Former Member
0 Kudos

thanks a lot now a I can connect to my database!!!!!