You'll want to ssh from server A with the following:
ssh user@serverB -L xxxx:127.0.0.1:yyyy
As long as you leave that tunnel open, you can connect to port xxxx on server A and your connection will be forwarded to port yyyy on server B.
As for whether or not this is the best option, that depends. Best option for remotely administering/debugging the database? Possibly. It's secure (as long as ssh access is secure). Is it the best for long term connections in production? Probably not. I'd suggest ACLs only allowing access to the database on server B from server A.
See the following Security StackExchange question for more details: https://security.stackexchange.com/questions/8861/what-is-the-best-practice-for-placing-database-servers-in-secure-network-topolog