we have webinterface to manage our different client installations and also copy over whole databases via the dbbackup command.

The serverside is all written in java (And vaadin) Sometimes we have very lengthy backup processes (500MB databases over 20MBit/sec Lines) and wish to show a progres bar.

Is there a way to use dbtools from java to get some sort of progress informations ? (As on the commandline of dbbackup for example)

Or is there another way to make backups across the wire and show some progress?


asked 14 Feb '12, 12:15

ASchild's gravatar image

accept rate: 14%

Is that a client-side or server-side backup (dbbackup -s)?

(14 Feb '12, 13:56) Volker Barth

Currently it's a client side backup, but I could transform it into a server side backup and then download the db files with sftp or similar...

(14 Feb '12, 14:24) ASchild

As DBTools is a C-based API, I guess a usage from Java will require some kind of JNI interface or the like - can't tell more, haven't done that...

Another approach with a looser coupling might be to make use of the MESSAGE statement to pass messages to other connections. ODBC apps can process such messages by using a particular callback - that works well IMHO. SA 11 JDBC clients seems to be able to read them as well, but I don't have a sample at hands.

The basic idea would be to

  • have a JDBC app that waits for input
  • turn the connection id of that waiting connection to a program that can call a C DLL
  • use a classic DBTools C DLL that calls DBBackup() and uses the callbacks to build according MESSAGE statements for a given connection ID, such as:

extern short _callback MessageRtn(char * messagestr)
if (messagestr != NULL)
// build message string from messagestr, such as
// sqlstr = "MESSAGE messagestr + " TO CLIENT FOR CONNECTION " + MyConnId + " IMMEDIATE"
// use ODBC or whatever C DB APO to execute that SQL statement
return (0);

So the DBTools DLL could "send" the progress messages of the backup to the JDBC connection.

Apparently, one could also make the DBTools API DLL to write messages to a file or send them via some IPC mechanism, and make the JDBC app read them...

permanent link

answered 15 Feb '12, 03:58

Volker%20Barth's gravatar image

Volker Barth
accept rate: 32%

edited 15 Feb '12, 04:02

Ok, that would be a way to go, but it looks like a long way and a stony one (ASA wersion dependent etc.)

I think we will take a simpler track: - Ask the asa server for the size of the .db and .log files - Start a server side backup - Via java remoting (which we already have) poll on the backup file sizes - Then transfer the backupfiles via sftp or java remoting back to the management server

Since we already have the java remoting file transfer in place, it will not require that much changes.



(15 Feb '12, 15:25) ASchild
Replies hidden

Be aware that the size of the backed up transaction log / database may not exactly match the size of the database prior to the backup. (e.g. the database size can change depending on the 'CHECKPOINT LOG COPY' options, and the transaction log grows while the backup is taking place on the database file).

(15 Feb '12, 17:09) Jeff Albion

I did now still do a remote dbbackup (From remote to local) First I ask the dbserver for the size of the DB file and then watch it grow as it is copied to the local system. (Apparently dbbackup does not preallocate the space)

With these two I can detect the current DB file size:

SELECT PropName, PropDescription, Value FROM sa_db_properties() where propname='FileSize'


SELECT PropName, PropDescription, Value FROM sa_db_properties() where propname='PageSize'

Is there a similar possibility to ask teh DB server for the size of the transaction log file ?

(17 Feb '12, 11:34) ASchild

select DB_EXTENDED_PROPERTY('FileSize', 'translog')

(17 Feb '12, 11:44) Volker Barth

Almost realtime support, cool :)

And thanks a lot

(17 Feb '12, 11:55) ASchild

The PROGRESS connection property can give you this information. This property was introduced in version 12.0.0.

FWIW: In order to get such messages, the according progress_messages database option must have been set to Raw or Formatted.

permanent link

answered 14 Feb '12, 12:42

Glenn%20Paulley's gravatar image

Glenn Paulley
accept rate: 43%

edited 15 Feb '12, 07:38

Volker%20Barth's gravatar image

Volker Barth

Hmm... unfortunally the servers are mainly v9 and v11

(14 Feb '12, 12:47) ASchild
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](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:


question asked: 14 Feb '12, 12:15

question was seen: 1,264 times

last updated: 17 Feb '12, 11:55