From what I've just stumbled upon on the net: Bar code scanners just translate the bar codes into a string of charsacters just like a keyboard.
Here's my idea: You could create a page that is a simple form containing a single input field. You can place an onChange event onto it. By doing so you can force the page to sleep for a second or two, giving the bar coder scanner enough time to fully translate the scanned code and input it onto the page, before auto-submitting the form to post information to your database.
I hope that made sense and helps.
🙂