Yes, we can. I can think of two ways. 1. Use BCS here. Configure service and create esternal content type using SharePoint designer. Now you are ready to access SQL data to SharePoint. 2. Write object model classes to use ado.net to connect SQL server. Access data throgh sqlconnection and use them in page/webpart. You can configure connection string in web.config or can keep it as a setting in application page.
Yes, Need to define the SQL Connection String in Web.Config