Both of those sentences are valid, the only rule in this case is that you either include both commas or no commas.
The reason for this is because placing one comma after the word and splits the sentence into an incomplete main clause:
This is done by using a database of patients and
as a result the factors which have any significance are obtained.
Using a comma after the phrase as a result will also produce an incomplete main clause:
This is done by using a database of patients and as a result
the factors which have any significance are obtained.
You could change the comma placement and say:
This is done by using a database of patients, and as a result the factors which have any significance are obtained
The main clause is now a complete standalone sentence.
So that's three sentences, all of which are grammatically correct. If you have a choice for deciding whether or not to use commas I would advise you to avoid them. Your writing style will flow better if you string together clauses with conjunctions like "because", "as", and "for" instead of breaking them up with commas and semi-colons.