Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Thursday, 26 February 2015

Installing the MySQL workbench on Ubuntu...

You can get the necessary mysql workbench deb 

"http://dev.mysql.com/downloads/workbench/#downloads"

First run the following:


sudo dpkg -i mysql-workbench-gpl-5.2.40-1ubu1104-i386.deb

As you know this will fail about the dependencies. Then wget and install the following:

wget https://launchpad.net/ubuntu/+archive/primary/+files/libzip1_0.9.3-1_i386.deb
wget http://launchpadlibrarian.net/94563300/libmysqlclient16_5.1.58-1ubuntu5_i386.deb

Next install:

sudo dpkg -i libzip1_0.9.3-1_i386.deb
sudo dpkg -i libmysqlclient16_5.1.58-1ubuntu5_i386.deb

If you're using 64bit, you'll want this instead:

wget https://launchpad.net/ubuntu/+archive/primary/+files/libzip1_0.9.3-1_amd64.deb
sudo dpkg -i libzip1_0.9.3-1_amd64.deb

wget http://launchpadlibrarian.net/94808408/libmysqlclient16_5.1.58-1ubuntu5_amd64.deb
sudo dpkg -i libmysqlclient16_5.1.58-1ubuntu5_amd64.deb

Then run the following:

sudo apt-get -f install python-paramiko libzip2 libmysqlclient18 mysql-client mysql-common python-pysqlite2 libdbi-perl libdbd-mysql-perl libplrpc-perl libnet-daemon-perl mysql-client

This too will fail, and ask you to re-run, just re-run it again:

sudo apt-get -f install

Launch it once from either your terminal mysql-workbench or Unity Dash, once it's in the launcher, right click on it and select "Lock to Launcher".

Thursday, 29 September 2011

SOLR Oracle data-importer with variableResolver in data-config.xml


Most applications store data in relational databases like mysql , oracle , db2 ...and searching over such data is a common use-case. The DataImportHandler is a Solr contrib that provides a configuration driven way to import this data into Solr. For the same we will create the data-config.xml. The data-config.xml will have the variable in the query.



The data-config for MySql will look like this :

<dataConfig>
<dataSource name="ds-db" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/dbname" user="root" password="root"/>
<dataSource name="ds-file" type="BinFileDataSource"/>
<document name="documents">
<entity name="book" dataSource="ds-db" query="select distinct
book.id as id,
book.title,
book.author,
book.publisher,
from Books book
where book.book_added_date >= to_date($ {dataimporter.request.lastIndexDate}, 'DD/MM/YYYY HH24:MI:SS')))"

transformer="DateFormatTransformer">
<field column=”id” name=”id”/>
<field column=”title” name=”title”/>
<field column=”author” name=”author”/>
<field column=”publisher” name=”publisher”/>
<entity name=”content” query=”select description from content where content_id='${book.id}'”>
<field column=”description” name=”description”/>
</entity>
</entity>
</document>
</dataConfig>

In the url you need to pass the variable resolver with value.
The url to start the data-import in this case will be :
http://localhost:8080/solr/admin/select/?qt=/dataimport&command=full-import&clean=false&commit=true&lastIndexDate='08/05/2011 20:16:11'

For the first time indexing you need pass “lastIndexDate=null”.


The data-config for Oracle will look like this :

<dataConfig>
<dataSource name="ds-db" driver="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@127.0.0.1:1521:test" user="dev" password="dev"/>
<dataSource name="ds-file" type="BinFileDataSource"/>
<document name="documents">
<entity name="book" dataSource="ds-db" query="select distinct
book.id as id,
book.title,
book.author,
book.publisher,
from Books book
where book.book_added_date >= to_date($ {dataimporter.request.lastIndexDate}, 'DD/MM/YYYY HH24:MI:SS')))"

transformer="DateFormatTransformer">
<field column=”id” name=”id”/>
<field column=”title” name=”title”/>
<field column=”author” name=”author”/>
<field column=”publisher” name=”publisher”/>
<entity name=”content” query=”select description from content where content_id='${book.Id}'”>
<field column=”description” name=”description”/>
</entity>
</entity>
</document>
</dataConfig>

The change here in data-config.xml for oracle id ${book.Id} and not the ${book.id}. It took me long time to find out this by debugging.