Expand my Community achievements bar.

SOLVED

How to create a Microsoft SQL connection on AEM Forms 6.3?

Avatar

Level 3

I am new to AEM Forms 6.3, but I have used LiveCycle ES4.  Under LiveCycle ES4 to create a connection, I added the SQL connection string to the adobe-ds.xml file under the deploy directory.  After restarting JBoss, I could use to connection to create a WSDL.  On AEM Forms 6.3 to add a SQL connection, do I have to use configMgr?  If I have to use it, how do I install it?  Thank you.

1 Accepted Solution

Avatar

Correct answer by
Level 10

In AEM - to connect to a Database - you need to write OSGi logic and use a DataSourcePool.

See this new Article we just put out.

Scott's Digital Community: Creating a Mail List Component for the Experience Manager Toy Store Site

It shows you how to write a OSGi service that uses a DataSourcePool. It also shows you how to configure a DataSourcePool service.

We used MySQL as an example - but this will point you in the right direction.

To get the data from a form to an OSGi, you can write a custom Form action too:

Scott's Digital Community: Creating a custom action for an Adobe Experience Manager Form component

Hope this helps....

View solution in original post

4 Replies

Avatar

Level 2

The file to edit for a database connection under AEM Forms 6.3 is  lc_turnkey.xml.

Avatar

Correct answer by
Level 10

In AEM - to connect to a Database - you need to write OSGi logic and use a DataSourcePool.

See this new Article we just put out.

Scott's Digital Community: Creating a Mail List Component for the Experience Manager Toy Store Site

It shows you how to write a OSGi service that uses a DataSourcePool. It also shows you how to configure a DataSourcePool service.

We used MySQL as an example - but this will point you in the right direction.

To get the data from a form to an OSGi, you can write a custom Form action too:

Scott's Digital Community: Creating a custom action for an Adobe Experience Manager Form component

Hope this helps....

Avatar

Level 2

Hi Smacdonald2008,

I am trying to connect with MYSQL. I have given JDBC configuration and used below code. But in below code i am getting datasource pool as null. Can you please help me to find where i am doing mistake?

@Reference

private DataSourcePool ds;

 

//Returns a connection using the configured DataSourcePool

private Connection getConnection()

{

LOGGER.info("************Inside get connection*********" + ds);

         DataSource dspService = null;

         Connection con = null;

        

         try

         {

        dspService = (DataSource) ds.getDataSource("hsqldbds");

        LOGGER.info("************Inside IF*********");

        if(dspService != null) {

        LOGGER.info("************Inside IF*********");

                 final Connection connection = ((DataSource) dspService).getConnection();

                  final Statement statement = connection.createStatement();

                 final ResultSet resultSet = statement.executeQuery("SELECT * from pet");

                  int r=0;

                  LOGGER.info("************Working*********");

                  while(resultSet.next()){

                     r=r+1;

                  }

                  resultSet.close();

                  }

            

           }

         catch (Exception e)

         {

        LOGGER.info("************ERROR*********" + e.getMessage());

             e.printStackTrace();

         }

             return con;

}

Also, Can you share me driver need to be used for SQL DB in AEM 6.4.

Avatar

Employee Advisor

6.3 onwards, in case you want to configure your Adaptive forms to connect to Database or any other Datasource you can use Form Data Model.

Form Data Model(FDM): AEM Forms data integration module allows you to create a form data model from disparate backend data sources such as AEM user profile, RESTful web services, SOAP-based web services, OData services, and relational databases. You can configure data model objects and services in a form data model and associate it with an adaptive form. Adaptive form fields are bound to data model object properties. The services enable you to prefill the adaptive form and write submitted form data back to the data model object.

Adobe Experience Manager Help | AEM Forms Data Integration