Giter Club home page Giter Club logo

copydb's Introduction

CopyDB

本工具用于将数据从一个库中导出,或者将导出的数据导入到另外的库。 这个工具是给开发人员定位问题使用。

这个工具的本地目录结构如下:

\--- CopyDB
     +--- config
     |    \--- application.properties\
     +--- copydb.jar
     +--- copydb.sh
     \--- somelibs.jar

具体使用方法如下:

填写配置文件

  • 修改配置文件application.properties
#定义第一个数据源src1
database.src1.url=jdbc:sqlserver://xx.xx.xx.xx:1433;databaseName=dbName
database.src1.username=userName
database.src1.password=password
database.src1.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver

#根据需要可以定义多个数据源,这里定义第二个数据源src2
database.src2.url=jdbc:sqlserver://xx.xx.xx.xx:1433;databaseName=dbName
database.src2.username=userName
database.src2.password=password
database.src2.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver

#定义一个数据集Students
dataset.students.table=students
dataset.students.sql=select * from students with(nolock) where school='No1School'

#根据需要可以定义多个数据集,这里定义第二个数据集schools
dataset.schools.table=schools
dataset.schools.sql=select * from schools with(nolock)

从数据库导出数据

执行命令启动导出 java -jar copydb.jar --from=db:src1 --to=file:output.json --datasets=students,schools

将数据导入数据库

执行命令启动导出 java -jar copydb.jar --from=file:output.json --to=db:src1 --datasets=students,schools

copydb's People

Contributors

gaoyushantw avatar boroborome avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

copydb's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.