deepak parmar
deepak parmar

Reputation: 701

How to access default hyperledger fabric-ca database

I have hyperledger fabric "First Network" up and running in Vagrant on Window 7. I would like to query on following tables of fabric ca database:

Kindly help me how and where I can find fabric ca database,

Thank You.

Upvotes: 4

Views: 2526

Answers (3)

Bassel Kh
Bassel Kh

Reputation: 1981

it is very simple, just install and run SQL client, for me; I installed SQuirreL SQL client, you need to install the JDBC jar file for SQLite from this link:

Then connect to Hyperledger fabric CA DB by setting the path file name enter image description here

connect to the database then, without username\password if you keep default values, you will see the requested tables as shown below enter image description here

I hope I could help.

Upvotes: 1

You need to login to the docker container to run sqlite3 fabric-ca-server.db. Follow these steps:

$ docker ps

find your Fabric-ca container name from the response. Then issue this command:

 $ sudo docker exec -it <your-ca>  /bin/bash 

After logging in, change directories:

 root@c6cc601b0360:/# cd ca 
 root@c6cc601b0360:/ca#

Then connect to the database:

root@c6cc601b0360:/ca# sqlite3 fabric-ca-server.db 

Run a test query:

root@c6cc601b0360:/ca# select * from users

Upvotes: 2

Keith Smith
Keith Smith

Reputation: 296

If you are using version 1.1, you can use the fabric-ca-client affiliation list and fabric-ca-client identity list commands to see the affiliations and users table, respectively. The ability to list the certificates will be in a future version of the fabric-ca-client.

By default, the fabric-ca-server uses SQLITE and the name of the database file is fabric-ca-server.db in the home directory of the fabric-ca-server. You can use the sqlite3 fabric-ca-server.db command to enter a sqlite shell, and then issue select * from users to list the users table for example.

Upvotes: 3

Related Questions