HI Benarji,
In CRM it is not recommended to retrieve data directly from the database, the recommended way is to retrieve the data through the web services, there are different options you can use like using SOAP calls by calling the old XML Webservices, by using
WCF using the Organization.svc service or with the new method by using REST with ODATA by using the OrganizationData.svc service. You will find sample codes on how to manage these services in the Microsoft CRM SDK that can be downloaded from this link
http://www.microsoft.com/download/en/details.aspx?id=24004
Regards,
Damian Sinay