sqlserver数据实时同步到mysql

sqlserver数据实时同步到mysql

1.安装安装mysqlconnector2.配置mysqlconnectorODBC数据管理器->系统DSN->添加->mysql ODBC 5.3 ANSI driver->填入data source name如jt,mysql的ip、用户名、密码即可3.新建链接服务器exec [email protected]='jt', --ODBC里面data source [email protected]='mysql', --自己随便@provider='MSDASQL', --固定这个@datasrc=NULL,@location=NULL,@provstr='DRIVER={MySQL ODBC 5.3 ANSI Driver};SERVER=192.168.5.188;DATABASE=suzhou;UID=root;PORT=3306;',@catalog = NULLexec [email protected]='jt',@useself='false',@rmtuser='root',@rmtpassword='password';select * from openquery(jt,'SELECT * FROM sz ; ')GOUSE [master]GOEXEC master.dbo.sp_serveroption @server=N'jt', @optname=N'rpc out', @optvalue=N'TRUE'GOEXEC master.dbo.sp_serveroption @server=N'jt', @optname=N'remote proc transaction promotion', @optvalue=N'false'GO---4.sqlserver和mysql新建库和表create database suzhou;create table sz(id int not null identity(1,1) primary key,orderno char(20) not null,ordertime datetime not null default getdate(),remark varchar(200))gocreate table sz(id int(11) not null ,orderno char(20) not null,ordertime datetime(6) not null ,remark varchar(200),primary key (id)) engine=innodb default charset=utf8;---5.建立回环--建立LOOPBACK 服务器链接EXEC sp_addlinkedserver @server = N'loopback' , @srvproduct = N' ' , @provider = N'SQLNCLI',@datasrc = @@SERVERNAMEgo--设置服务器链接选项,阻止SQL Server 由于远过程调用而将本地事务提升为分布事务(重点)USE [master]GOEXEC master.dbo.sp_serveroption @server=N'loopback', @optname=N'rpc out', @optvalue=N'TRUE'GOEXEC master.dbo.sp_serveroption @server=N'loopback', @optname=N'remote proc transaction promotion', @optvalue=N'false'GO----6.编写触发器和存储过程----6.1 insert--重写触发器use suzhougoalter trigger tr_insert_sz on suzhou.dbo.szfor insertasdeclare @id int, @orderno char(20),@ordertime datetime,@remark varchar(200)select @id=id,@orderno=orderno,@ordertime=ordertime,@remark =remark from inserted;beginprint @idprint @ordernoprint @ordertimeprint @remarkexec loopback.suzhou.dbo.sp_insert @id,@orderno,@ordertime,@remarkendgo--存储过程use suzhougocreate PROCEDURE sp_insert(@id int,@orderno char(20),@ordertime datetime,@remark varchar(200))ASBEGINSET NOCOUNT ON;Insert openquery(jt, 'select * from sz')(id,orderno,ordertime,remark)values(@id,@orderno,@ordertime,@remark)ENDgo----6.2 update--重写触发器use suzhougocreate trigger tr_update_sz on suzhou.dbo.szfor updateasdeclare @orderno char(20),@remark varchar(200)select @orderno=orderno,@remark =remark from inserted;beginexec loopback.suzhou.dbo.sp_update @orderno,@remarkendgo--存储过程use suzhougocreate PROCEDURE sp_update(@orderno char(20),@remark varchar(200))ASBEGINSET NOCOUNT ON;update openquery(jt, 'select * from sz') set [email protected] where [email protected]数据测试use suzhougoupdate sz set remark='ocpyang' where orderno='a001'go----6.3 delete--重写触发器use suzhougocreate trigger tr_delete_sz on suzhou.dbo.szfor deleteasdeclare @orderno char(20)select @orderno=orderno from deleted;beginexec loopback.suzhou.dbo.sp_delete @ordernoendgo--存储过程use suzhougocreate PROCEDURE sp_delete(@orderno char(20))ASBEGINSET NOCOUNT ON;delete openquery(jt, 'select * from sz') where [email protected]数据测试use suzhougodelete from sz where orderno='a001'go

1.安装安装mysqlconnector2.配置mysqlconnectorODBC数据管理器-系统DSN-添加-mysql
ODBC 5.3 ANSI driver-填入data source name如jt,my…

前言

NoSQL 非关系数据库。
MongoDB is an open-source, document database designed for ease of
development and scaling.
MongoDB是开源的文档数据库。文档也就是关系数据库里面的一个Record,而文档的组织形式是collection.
网上找了一些资料都太旧了,还是直接英文文档最快。
首先官网文档镇楼,开头查了一些中文的MongoDB的资料之类的,发现其实官方文档最好。

首先介绍一下document,感觉就是Json格式的数据。这里介绍了一下如何导入数据。

{
  "address": {
     "building": "1007",
     "coord": [ -73.856077, 40.848447 ],
     "street": "Morris Park Ave",
     "zipcode": "10462"
  },
  "borough": "Bronx",
  "cuisine": "Bakery",
  "grades": [
     { "date": { "$date": 1393804800000 }, "grade": "A", "score": 2 },
     { "date": { "$date": 1378857600000 }, "grade": "A", "score": 6 },
     { "date": { "$date": 1358985600000 }, "grade": "A", "score": 10 },
     { "date": { "$date": 1322006400000 }, "grade": "A", "score": 9 },
     { "date": { "$date": 1299715200000 }, "grade": "B", "score": 14 }
  ],
  "name": "Morris Park Bake Shop",
  "restaurant_id": "30075445"
}

相关文章

相关搜索:

今天看啥

搜索技术库

返回首页

  • Android中Application类的详细解释:,androidappl
  • 基于WebSocket构建移动端实时应用,websocket构建
  • javascript验证数据类型,javascript数据类型
  • AJAX MVC
    服务器返回Json数据,客户端获取Json数
  • 黑马day11
    脏读数据&解决方案,黑马da
  • 数据结构之—C语言实现哈夫曼树和编码,-

相关频道:
oracle  sybase  Sql
Server  DB2  Mysql  MsSql  Access  数据库开发  数据库管理  数据库前沿  数据库教程  数据库工具  数据库安全  数据库基础  

永利皇宫登录网址 ,records(documents),collections,databases

永利皇宫登录网址 1

一个数据就是一个record,然后records由collections组织,然后collections组成了database.

关于安装

  1. 首先下载MongoDB,下载地址,我的是windows系统,其实蛮简单的,下载,然后安装,因为现在有msi的文件了。

  2. 然后安装省略…

  3. 然后我们打开安装后的文件,有bin目录,介绍一下这些exe们

![](https://upload-images.jianshu.io/upload_images/2099962-9c3cb1b26ad44851.png)

bin目录下

亲爱的README给了介绍吧

COMPONENTS

bin/mongod – The database process.
bin/mongos – Sharding controller.
bin/mongo – The database shell (uses interactive javascript).

UTILITIES

bin/mongodump – MongoDB dump tool – for backups, snapshots, etc..
bin/mongorestore – MongoDB restore a dump
bin/mongoexport – Export a single collection to test (JSON, CSV)
bin/mongoimport – Import from JSON or CSV
bin/mongofiles – Utility for putting and getting files from MongoDB
GridFS
bin/mongostat – Show performance statistics

网站地图xml地图