Fix #2816 about muilt database

Get the connection through the model.