Fabric JDBC connector implements a pure java, type 4 JDBC driver that executes SQL queries on Hyperledger fabric blockchain. It facilitates getting the data in and out of fabric in JDBC compliant manner. The Fabric JDBC Connector can be used to perform ETL, BI reporting and analytics using the familiar SQL language.
It uses blkchn-sql-driver to parse the query and create corresponding logical plan. This logical plan is then converted into an optimized physical plan. The driver extends and implements the physical plan, using corresponding function calls of fabric-sdk-java to interact with Fabric network. The driver then converts the returned objects to a JDBC compliant result set and return it to the user.
Dependency | Version |
---|---|
maven | 3.3.3 |
java | 1.8 |
fabric-sdk-java | 1.1.0 |
spark | 2.0.2 |
- Created Spark Connector Module: Use spark connector to connect Spark with fabric.
- Create User : allows creation of new user with certificate authority
- Install Only : This option can be given with Create and upgrade chaincode syntax.
- Instantiate Only : This option can be used with create chaincode syntax.
- Upgrade Only: It can be used with upgrade chaincode syntax.
- Enrolment Certificate is stored in-memory.
- Querying on blocks, transactions, transaction actions and read write sets
- Creating Assets
- Querying Assets
- Deleting Assets
- Creating Asset schema
- Dropping Asset schema
- Creating Chaincode
- Upgrading Chaincode
- Create User
- Download or clone blkchn-sql-driver project
git clone https://github.com/Impetus/blkchn-sql-driver.git
- build blkchn-sql-driver using
mvn clean install -Pgen-sources
- Download fabric-jdbc-connector source code or use
git clone https://github.com/Impetus/fabric-jdbc-connector.git
- build it using
mvn clean install
Fabric JDBC connector is a maven based project. It can be directly added as maven dependency in your project in the following manner :
- Add below in dependency:
<dependency>
<groupId>com.impetus.fabric</groupId>
<artifactId>fabric-jdbc-driver</artifactId>
<version>${fabricjdbcdriver.version}</version>
</dependency>
Build your project with the above changes to your pom.xml.
If you have run example code or integration test. It will create docker images, that need to clean manually. it consume approximately 100 MB of space upon running integration test once.
You need to run these command to free up space.
- remove exited docker process.
docker rm -v $(docker ps -a -q -f status=exited)
- remove images by giving chaincode name pattern as in below command
docker rmi -f `docker images|grep -i chncodefunc|awk '{ print $3 }'`
docker rmi -f `docker images|grep -i assettransfer|awk '{ print $3 }'`
docker rmi -f `docker images|grep -i sacc-1.0|awk '{ print $3 }'`
- Delete dangling volume occupied, if everything is clean, it will give message: "requires a minimum of 1 argument"
docker volume rm $(docker volume ls -qf dangling=true)
Fabric JDBC Connector is backed by Impetus Labs - iLabs. iLabs is a R&D consulting division of Impetus Technologies. iLabs focuses on innovations with next generation technologies and creates practice areas and new products around them. iLabs is actively involved working on blockchain technologies, neural networking, distributed/parallel computing and advanced analytics using spark and big data ecosystem. iLabs is also working on various other Open Source initiatives.