How to interact with database in alfresco (Like in ftl file two fields are there enter any thing in that fields stored in DB using alfresco API"s only)…???
you DO NOT interact witht the database directly. You write code that uses either the Public Java API, the JavaScript API, the ReST / CMIS or Public API for remote access. See <a href="http://docs.alfresco.com/5.0/concepts/API-intro.html">this introduction into Alfresco APIs</a>. Depending on what you want to develop (plugin for Alfresco, external client …) you need to chose the API that is appropriate. For the Public Java API, <a href="http://dev.alfresco.com/resource/AlfrescoOne/5.0/PublicAPI/org/alfresco/service/cmr/repository/NodeS...">NodeService</a> is one of the best places to start. You inject the service via Spring bean configuration into your custom component (reference name "NodeService") and can use the service to access the properties ("fields") of a document / object - among other things.