Goal
How-to create a "Connection" via REST API calls to access a MySQL database.
For this example the (local) Datameer MySQL database is used.
Learn
Step-by-step guide
First gather a valid JSON dump according to our documentation REST API Connections - ReadConnection and dump it into a file by using the redirect output via
> ToLocalMySQLInstance.JSON |
This dump will be used now to create a new "Connection" by editing it. Within the JSON dump you find at first a block where you can specify the name of the artifact and connection. I show an example for a connection to the Datameer local MySQL instance and dap database.
{ "version" : "4.5.5" , "className" : "datameer.dap.common.entity.DataBaseConnection" , "file" : { "uuid" : "00000000-0000-0000-0000-000000000000" , "path" : "/Data/Connections/ToLocalMySQLInstance.dst" , "description" : "To local MySQL instance." , "name" : "ToLocalMySQLInstance" }, "typeId" : "das.JdbcDataStoreType" , "properties" : { "user_name" : [ "dap" ], "password" : [ "SECURE:0:op8MeRJ6EyX7hkN2W3GtTg\u003d\u003d" ], "key.connectionUrl" : [ "jdbc:mysql://localhost:3306/dap?tinyInt1isBit\u003dfalse" ], "dataStoreTemplate" : [ "false" ], "dataStoreUsage" : [ "IMPORT" ] }, "dbType" : { "name" : "MySQL" } } |
The created or edited payload you can now upload according REST API Connections - Create Connection.
The UUID zeroed is a required field. If another similar UUID exists in the DB, Datameer will automagically create another UUID on the fly. If the given path and folder is not existing, the folder and the structure will be created during upload.
Note: If the payload document has multiple UUIDs, make sure that they are all unique.
Comments
0 comments
Please sign in to leave a comment.