Macro, calc get data from db, do i have to use odb file

i want to use macro to achieve next purpose :

in a calc file, there is a button, i want to click this button to get data from db, and put the data in the database range(
cells range in calc file), there are 2 solutions as far as i know :

  1. create a .odb file manually, register it as data source manually, then use this data source in macro to connect db and import data to database range

  2. create and register .odb file by macro, then use it to connect db and import data to database range.

both these 2 solutions need to use .odb file.

so can i achieve my purpose without .odb file?

Thanks in advance!

I have exactly the same problem - I have db in base and I want to send sql request to DB, process it in calk and send data back to db.

Some links, maybe can help:

[Calc] Import by parameters in cells.

http://extensions.libreoffice.org/extension-center/spreadsheet-population

http://extensions.services.openoffice.org/en/project/DbR

http://extensions.services.openoffice.org/en/project/jaguar