I have a project that can potentially use a SQL server as a host for it's data.

When a user starts the application for the first time, a wizard walks them through selecting how to store their data.

If a user selects the SQL option and indicates that the database they want to use doesn't exist and that the software needs to create it, what's the better choice:

1) Have the wizard connect to the SQL server, and if it can connect, check to make sure the user name they provided has all the permissions necessary to store the data on the server (such as create databases, use the select, insert, update, delete statements, etc...) and if they do, continue with the configuration wizard...

- or -

2) Assume that the user knows they have permissions, don't check on the permissions and just attempt to create the database and use the statements necessary. If at run time the queries fail, throw an exception and let the user know what the problem is?

Maybe both?

Recommended Answers

All 2 Replies

You will be wrapping the code that creates the database anyway, so just supply good error messaging and go with the assumption. IOW, why add additional code when SQL is going to do those checks for you anyway regardless of your pre-checks.
JMO

That's what I figured...and that's what I intended to do if no one gave a good reason to do otherwise.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.