Besides getting the logs as Jeroen suggests, please also include details on what type of project you are creating, and the context in how you access SharePoint (eg. event handler, timer job, console application, web part).
If you run in context of the IIS SharePoint will impersonate your user. That means that all database access runs in context of the application pool user, so SQL exceptions shouldnt be related to your current user not having access to SQL.
If you for example in a web part use the object model to retrieve items that your current user does not have access to in SharePoint, it will give you a security exception.
What running with elevated privileges does, is switching context to disable impersonation, so for that to work you need to run impersonated in the first place. This is why RWEP will not work when you are not running in IIS context (again like a web part).
Also RWEP has some issues, so be careful when using it and be sure you understand why you are using it, or you are better off first investigating why your code fails in the first place.
Another option is using SPUserToken for impersonation. Read more about this here and here.
Again: tell us a bit more about what you want to achieve and how you are going about implementing it, to make us help you more.