R use db as backend