I am using SQL Anywhere 17 Developer’s version. I have a local UltraLite 17 database that I can access (connect to) with SQL Central 17 and a Visual Studio 2017 app using UltraLite.NET 17. I have subsequently converted this app into an UWP app utilizing the WinRT UltraLite library. This app cannot connect to the database that .NET app and SQL Central can connect to. The WinRT UltraLite library returns with the error “Access is denied”, error number -82. The same connection parameters: uid, pwd, and dbkey are used in all three instances. The UWP app has been run via the VS debugger in the “Local Machnine” and “Simulator” with the same results. The “Portable” project is compiled for “AnyCPU” while the UWP project is compiled for “x64”. I am using the x64 UltraLite libraries too.

In Sql Central 17 I created a new UltraLite db that does not require an uid, pwd or dbkey. I can connect to it via my app with UltraLite.NET but not the UWP app built with WinRT UltraLite. Same “Access is denied” error.

I have tried the connection string with and without double and single quotes. Yes in UWP apps one has to build the connection string and not set an object’s parameters (at least I couldn’t find it). Any thoughts would be greatly appreciate

asked 15 May '17, 10:13

BESpring's gravatar image

BESpring
141141421
accept rate: 20%


What is the location of the database file?

UWP can only access certain file locations by default. If the database is stored in a location other than those allowed locations, you will encounter this error.

See https://docs.microsoft.com/en-us/windows/uwp/files/file-access-permissions#accessing-additional-locations.

permanent link

answered 15 May '17, 11:14

Chris%20Keating's gravatar image

Chris Keating
7.7k49127
accept rate: 32%

Location seems to be an issue. I can connect to two different UL 17 DB's in a certain location but not others. The location they are accessible is where the one was created with a UL Sample program - custdb.udb. The interesting thing is that in the locations that I cannot access these two databases I can access an XML file I have with StreamReader. I guess that threw me off a little since I'm not useing StorageFile. I will read the link you provided in detail. Thanks.

I have a third database that was an UL 12 db and converted to 17 that I can't connect to from any location - Access is Denied. This is the database that I want to connect to and eventually sync once we get all the software purchased and installed, e.g. MobiLink 12 upgraded to 17. Any thoughts on this issue?

(15 May '17, 12:34) BESpring

You may want to try putting the converted v17 UL database file in the location ApplicationData.Current.LocalFolder.Path which is accessible in UWP:

UltraLite.Connection conn = UltraLite.DatabaseManager.OpenConnection("dbf=" + ApplicationData.Current.LocalFolder.Path + "\mydatabase.udb;dbkey=mydbkey");

The ApplicationData.Current.LocalFolder.Path points to a location under local app data for the application. That location is:

%localappdata%\packages\<package_name>\LocalState

where package_name is defined in the Package.appxmanifest under the Packaging tab in the IDE -or- as Name in the file. By default, it is a GUID value.

(15 May '17, 12:59) Chris Keating

The location you described is the location I was using. I went ahead and reconverted the UL 12 db to UL 17 and now it can be connected to with my UWP app in the location you suggested.

permanent link

answered 15 May '17, 14:37

BESpring's gravatar image

BESpring
141141421
accept rate: 20%

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:

×161
×49

question asked: 15 May '17, 10:13

question was seen: 3,402 times

last updated: 15 May '17, 14:37