Accessing MaxCompute Lightning with Java and Python for App Development

Join us at the Alibaba Cloud ACtivate Online Conference on March 5–6 to challenge assumptions, exchange ideas, and explore what is possible through digital transformation.

MaxCompute Lightning provides interactive query services for Alibaba Cloud MaxCompute, and supports easy connection to MaxCompute projects based on the PostgreSQL protocol and syntax. This service allows you to quickly query and analyze MaxCompute project data using standard SQL and commonly used tools.

Many developers want to use Lightning’s features to develop data applications. This article will introduce examples showing how Java and Python connect to Lightning for application development (the endpoint and user authentication information of the region where your project is located needs to be replaced when referring to these examples in the article).

Using JDBC to Access Lightning with Java


Using Druid to Access Lightning with Java

Pom dependency:

Spring configuration:

Code access:

Using pyscopg2 to Access Lightning with Python


Using ODBC to Access Lightning with Python

You need to install and configure an ODBC driver on your computer to use this method.

Sample code:

Lightning provides a PostgreSQL-compatible interface, so you can develop Lightning applications just like PostgreSQL applications.

Learn more about Alibaba Cloud MaxCompute at


Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store