Connecting to the SteemSQL database via R

As discussed in the previous post (https://busy.org/@verodato/steem-blockchain-the-forest-and-the-trees), we’re going to use the SteemSQL service to get the Steem blockchain data. The connection to the database will be made using the R software (https://www.r-project.org/). It’s a widely used open source statics and programming language and environment. Remember to download the free version of the RStudio editor if it is your first time trying R (https://www.rstudio.com/). You’ll need to install the RJDBC package too.

The R code to connect to the SQL server is the following (“user” and “password” are supplied by the SteemSQL service upon payment):

    require(RJDBC)
    drv <- JDBC("net.sourceforge.jtds.jdbc.Driver",
             "/home/user/Downloads/jtds-1.2.8-dist/jtds-1.2.8.jar") 
    conn <- dbConnect(drv, "jdbc:jtds:sqlserver://vip.steemsql.com;DatabaseName=DBSteem", domain="windows domain", user="username", password="userpassword")

Once connected, we can make a query, for example, to check what is the total number of accounts in the Steem blockchain:

    sqltxt <- "SELECT COUNT(ID) FROM Accounts"
    dbGetQuery(conn, sqltxt)

That’s it! Quite easy (if you had no trouble installing stuff). In the next post we’ll see how to get Steem delegation data and how to calculate time series from it. If you have any doubt about installing R, R packages, RStudio, MS drive, put it in the comments below and I’ll try to help you.

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now