Help Center > > Developer Guide> Demos> MySQL SDKs

MySQL SDKs

Updated at: Aug 30, 2019 GMT+08:00

This topic uses a MySQL SDK-based demo application as an example to describe how to configure an application to enable connection to BCS and successful running.

Preparation

Table 1 Resource list

Resource

Link

Chaincode file

account.zip

MySQL SDK demo package (Maven project)

MysqlDemoAccount.rar

Procedure

  1. Buy a BCS service. The following table lists the service parameters.

    Table 2 Parameters

    Parameter

    Setting

    Billing Mode

    Select Pay-per-use.

    Region

    Retain the default value.

    Service Name

    Enter demo.

    Edition

    Select Basic.

    Blockchain Type

    Select either Private or Consortium.

    Cluster Type

    Select CCE cluster.

    Container Cluster

    Select an existing container cluster.

    Network Storage

    Select an existing SFS file system.

    Ledger Storage

    Select Relational database (MySQL).

    Peer Organization

    Create a peer organization named xxxx with two peers.

    Select an existing RDS instance, and use the username root and the password specified when the RDS instance was created.

    Consensus Mechanism

    Select Solo.

    Security Mechanism

    Select ECDSA.

    Version

    Select a 2.X.X version (corresponding to Fabric v1.1.0).

    NOTE:

    This demo describes only the operation procedure for Fabric v1.1.0. If Fabric v1.4.0 is used, the demo may fail to run.

    Blockchain Mgmt. Initial Password

    Set a password.

    Confirm Password

    Enter the password again.

    Enable Support for RESTful APIs

    Select No.

    Orderer Quantity

    Set it to 1.

    Channel Configuration

    Create a channel named demochannel, and add the peer organization xxx1 to the channel.

    Click Next, confirm the configurations, and click Submit. If the status of the service and organization is Normal, the service has been successfully created.

  2. Go to the Blockchain Management console to install and instantiate the chaincode. The chaincode installation and instantiation dialog boxes are shown in following figures.

  3. Download the administrator certificates of the orderer and xxx1 organizations on the Service Management page.

  4. Download and decompress the SDK configuration file.

  5. Modify the downloaded SDK configuration.

    Add adminPrivateKey and signedCert, and set the path based on the certificate storage path. The following figure shows an example after the modification.

  6. Import the demo package to the Eclipse.

    Project structure description:

    • The storage path of the SDK configuration file is fixed to src/main/fixture/config.
    • The file name can be set to any value.

      In the following figure, network-config.yaml in the config directory is an SDK configuration file.

    • The peer and orderer certificates can be placed anywhere in the project, but their locations must be the same as those specified in the SDK configuration file.

      As shown in the following figure, two certificates are located at the src/main/fixture/channel directory.

  7. Save the two certificates downloaded in step 3 to the directory specified by the code, and decompress them.

  8. Save the SDK configuration file modified in step 5 to src/main/fixture/config.

  9. Execute FabricJDBCWorkflowTest.java under src\test\java\com\huawei\fabricsql\jdbc to transfer money.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel