Configuring Geolocation database to WSO2 IS-Analytics using MySQL

Pamoda Wimalasiri
1 min readMay 20, 2018

--

  • Download the Geolocation data from here
  • Unzip the downloaded file
  • Using MySQL, create a database named “GEO_LOCATION_DATA
mysql> CREATE DATABASE GEO_LOCATION_DATA;mysql > USE GEO_LOCATION_DATA;
  • Create the tables by executing the script mysql.sql in the downloaded Geolocation Data/dbscripts directory
mysql> source path/to/file/mysql.sql;
  • Restore data to BLOCKS and LOCATION tables

Importing Geolocation Data/data/BLOCKS.csv

LOAD DATA LOCAL INFILE ‘/path/to/file/BLOCKS.csv’
INTO TABLE BLOCKS FIELDS
TERMINATED BY ‘;’
ENCLOSED BY ‘“‘
LINES TERMINATED BY ‘\n’
IGNORE 1 LINES;

Importing Geolocation Data/data/LOCATION.csv

LOAD DATA LOCAL INFILE ‘/path/to/file/LOCATION.csv’
INTO TABLE LOCATION FIELDS
TERMINATED BY ‘;’
ENCLOSED BY ‘“‘
LINES TERMINATED BY ‘\n’
IGNORE 1 LINES;
  • Download JDBC driver for MySQL and copy it to <IS_ANALYTICS_HOME>/repository/components/dropins directory.
  • Configure geolocation-datasources.xml file in the <IS_ANALYTICS_HOME>/repository/conf/datasources directory as follows. (here the username and the password should be MySQL credentials)
<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
<datasources>
<datasource>
<name>GEO_LOCATION_DATA</name>
<description>The datasource for Geo Location database</description>
<jndiConfig>
<name>jdbc/GEO_LOCATION_DATA</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/GEO_LOCATION_DATA</url>
<username>wso2carbon</username>
<password>wso2carbon</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive
>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
<defaultAutoCommit>false</defaultAutoCommit>
</configuration>
</definition>
</datasource>
</datasources>
</datasources-configuration>

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Pamoda Wimalasiri
Pamoda Wimalasiri

Written by Pamoda Wimalasiri

Associate Technical Lead @ WSO2 focused on the IAM domain

No responses yet