Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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

asked 20 Sep '12, 12:09

alvasrey's gravatar image

alvasrey
16113
accept rate: 0%


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.

permanent link

answered 20 Sep '12, 12:45

Tom%20Slee's gravatar image

Tom Slee
1.3k21629
accept rate: 29%

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

(20 Sep '12, 15:34) alvasrey
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×79

question asked: 20 Sep '12, 12:09

question was seen: 3,184 times

last updated: 20 Sep '12, 16:31