Extract data from oracle database and transfer to MongoDB

99 views
Skip to first unread message

deepan sanghavi

unread,
Aug 30, 2015, 7:16:02 AM8/30/15
to mongodb-user
Hi guys,
Can anyone help me about how to extract data from oracle and transfer it to MongoDB? which programming language is suitable for this?
Requirements:
Initially i want to transfer all data in specific oracle table to MongoDB database and after that after every 5 mins, i want to transfer newly inserted records in that particular table.
Any help will be appreciated.
Thanks. 

Rob Moore

unread,
Aug 30, 2015, 7:48:53 PM8/30/15
to mongodb-user

Deepan -

I don't think you are going to find a utility to do exactly what you want and will need to write a simple application. There are a lot of local issues to be resolved:

  * Who are the field types going to be mapped to MongoDB.  For basic types this won;t be a large issue but don;t be surprised if the database has non-basic types.
  * How to tell if a record has been updated/inserted?

I created a simple sample application that should get you started:


I tested the application with the sakila sample database and MariaDB. 

   java -cp lib/*.jar migrate.mongodb_user20150830.MigrateFromJdbc \
       --jdbc-class=org.mariadb.jdbc.Driver  \
       --jdbc=jdbc:mysql://localhost:3306/sakila?user=root&password= \
       --mongodb=mongodb://localhost:27017/temp \
       --table=film_actor

That gives a 'film_actor" collection in the "temp" database:
> db.film_actor.count()
5462
> db.film_actor.findOne()
{
"_id" : ObjectId("55e39548c02cac17cea85b69"),
"actor_id" : NumberLong(1),
"film_id" : NumberLong(1),
"last_update" : ISODate("2006-02-15T05:00:00Z")
}

Let me know if you have any questions.

Rob.
Reply all
Reply to author
Forward
0 new messages