DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones Build AI Agents That Are Ready for Production
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
Build AI Agents That Are Ready for Production

Just dropped: New 2026 “Cloud-Native Foundations” Trend Report. See how teams are tackling complexity, cost & reliability.

AI can investigate. Engineers still decide. See how both work together across incident response in this DZone + Datadog webinar on Oct. 29.

Related

  • Create Proxy Application for Mule APIs
  • Create Custom DataWeave Functions in Mule 4
  • Migrating MuleSoft System API to AWS Lambda (Part 1)
  • MuleSoft: Do You Have an Extra Mule Under the Hood?

Trending

  • Jakarta Batch in Practice: Reliable Chunk-Oriented Processing for Enterprise Workloads
  • OpenAI ‘o’ Leak: What We Know About ChatGPT’s Always-On Assistant Before DevDay
  • How a 30B Model Runs on Your Laptop
  • Mistaking Code Production for Engineering Progress: AI Productivity Myths Part 1
  1. DZone
  2. Data Engineering
  3. Databases
  4. Connect to AWS Athena Database in a Mule Application With Generic Database

Connect to AWS Athena Database in a Mule Application With Generic Database

This blog helps understand the steps to configure the Mule application to use generic database configuration to connect to Amazon Athena using the AWS Athena JDBC Driver.

By 
Anupam Chakraborty user avatar
Anupam Chakraborty
·
Aug. 07, 23 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
2.9K Views

Join the DZone community and get the full member experience.

Join For Free

This would be a short tutorial on connecting from MuleSoft to AWS Athena Database. We will use Generic Database Driver.

 Please read through the following resources for further information before getting started, just in case. 

  • Introduction to MuleSoft Anypoint Studio
  • Introduction to building API using MuleSoft
  • MuleSoft Database Connector
  • MuleSoft Database Connector: Configuring a generic connection
  • Connect Amazon Athena with JDBC

We will get started and go through each process step by step. Let's assume that we have the following information before getting started:

  • Athena S3 Output Location:
  • AWS Region:
  • UserName:
  • Password:

Get Started

We will start by creating a Project in Anypoint MuleSoft Platform. If you want to understand how to do this, please check my blog on Introduction to Building API Using MuleSoft. 

new mule project

 

Once we have created the application, the first step is to update our POM with the necessary JAR. I was not able to find a MAVEN Repository having the necessary JAR Files available to be used. However, I was able to get the JAR files.

The JAR files can be available for download here in my GitHub space.

Alternatively, you can download the JAR file from the AWS Documentation Connect Amazon Athena with JDBC.

In my case, I am using version 2.1.0.1000, the JDBC driver with AWS SDK.

Once the corresponding JAR is downloaded, we need to upload the same to the artifactory that we use. In my case, I will simply upload this to my Maven Repository using the following command.

Shell
 
mvn install:install-file \
   -Dfile= \
   -DgroupId= \
   -DartifactId= \
   -Dversion= \
   -Dpackaging= \
   -DgeneratePom=true

 

In my case:

mvn install:install-file   -Dfile= -DgroupId=aws.athena -DartifactId=AthenaJDBC42 -Dversion=2.1.0.1000 File Upload

I would overwrite the pom file that I have downloaded from the GitLab.

Set Up My Application POM File

Once completed, we must update my POM File at 2 places:

  • Add the dependency to the AthenaJDBC42 JAR.
XML
 

	aws.athena
    AthenaJDBC42
    2.1.0.1000

 

  • Add the shared library configuration.
XML
 

	org.mule.tools.maven
    mule-maven-plugin
    ${mule.maven.plugin.version}
    true
    
		
			
				aws.athena
				AthenaJDBC42
			                              
		
		mule-application
	


Starting the Code

Here is an example of the code used. We will head back to the actual XML and start by creating a flow consisting of the following, in order:

  • HTTP Listener
  • Logger
  • Database Select
  • Logger
  • Map to convert the output to JSON
  • The Flow should look something like this.

flow

Here is the code that I have in my XML:

XML
 



     
     
          
     
     
     
          
     
     
     
          
          
          
               
          
          
          
               
                     
               
          
     

 

Testing My Application

Finally, I will run my application in MuleSoft. 

 run my application in MuleSoft

Once the application is deployed, up and kicking, we can call the API from Postman:

call the API from Postman

Conclusion

This blog explains the steps required to configure the Mule application to use generic database configuration to connect to Amazon Athena using the AWS Athena JDBC Driver. Please let me know your thoughts. The idea was to connect to the database. Of course, we should have proper error handling, HTTPs security, etc., in the application.

AWS Database MULE MuleSoft application

Published at DZone with permission of Anupam Chakraborty. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Create Proxy Application for Mule APIs
  • Create Custom DataWeave Functions in Mule 4
  • Migrating MuleSoft System API to AWS Lambda (Part 1)
  • MuleSoft: Do You Have an Extra Mule Under the Hood?

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook