Please be aware that the SAP SQL Anywhere Forum will be shut down on August 29th, 2024 when all it's content will be migrated to the SAP Community.

Hi, all. I have a strongly encrypted db and need to run dbunload for it (Sybase 16). As I understand connection string should be something like this: "DBA=dba;PWD=sql;DBF=mydb.db;DBKEY=theKey". But there is a workflow for dbeng16 to load theKey from file, which could be encrypted with dbfhide. The question is: is it possible to specify encryption key to dbunload via file instead of doing this explicitly?

another question is: how to decrypt from command line file encrypted with dbfhide? is there a command to the utility?

another question is: is it possible to clean up transaction history and clean up logically deleted parts of the data base without using dbunload utility (e.g. via some sql code)?

asked 25 May '15, 12:52

LevIlya's gravatar image

accept rate: 0%

To put the database encryption key in a file and then use the file as part of a connection string (for the purposes of autostarting a database) you need to use a FILEDSN.

E.g. Put these lines in a file (say "mydb.key"):


Then use the connection string:


If you want you may then obfuscate the file containing the key. Example:

dbfhide mydb.key mydb.key.hidden

You would then use this connection string:


There is no command to de-obfuscate the obfuscated file created by dbfhide (that would defeat the purpose, wouldn't it!).

I think your last question is about recovering space in your database file? If this is the question then the only way to "shrink" the database file is to rebuild it (e.g. via dbunload -an|-ar). But note that there is rarely a reason to do this since the unused space in the database file will get reused when you add more data into the database.

Note: In the future I would suggest that you put each of your questions in a separate question on this forum. This makes it easier for people to answer your questions as well as future visitors to find answers to their questions that are similar to yours.

permanent link

answered 25 May '15, 13:26

Mark%20Culp's gravatar image

Mark Culp
accept rate: 41%

edited 25 May '15, 13:30

Thanks for the answer. I've put these 3 questions in the same post, 'cause they are as "else" branches in "if-else" structure.

(25 May '15, 16:19) LevIlya

the only problem I face with the FILEDSN is that the file must have extension .dsn. otherwise I've got an error message:

SQL Anywhere Unload Utility Version

DSN '???' does not exist

(26 May '15, 04:53) LevIlya
Replies hidden

Interesting, I tested my steps on both Windows and Linux using exactly the file names that I posted and it worked. I also checked the code and there is no dependency on the extension of the file (at least not for Windows NT and Linux/Unix). However I did find a requirement on Windows CE that the FILEDSN file name be given an ".dsn" extension. Are you using CE? If not then you should be able to use any file name that you like.

(26 May '15, 13:14) Mark Culp

If you have separate questions, usually it's a better idea to post multiple questions on the forum. In this case, I know the answers to the first two questions but not the third.

  1. You can use a file with dbunload as well, so if you put "-c UID=dba;PWD=sql;DBF=mydb.db;DBKEY=theKey" into a file and then use dbfhide on it, you can run dbunload @myparmsfile.txt. Edited to add: Or you can do what Mark suggested and use an encrypted FileDSN.
  2. There is no way to decrypt a file that's been hidden with dbfhide.
permanent link

answered 25 May '15, 13:28

Graeme%20Perrow's gravatar image

Graeme Perrow
accept rate: 54%

edited 25 May '15, 13:32

Your answer
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 25 May '15, 12:52

question was seen: 2,608 times

last updated: 26 May '15, 13:15