English 中文(简体)
旧的MySQL数据库中的气象数据
原标题:Migrate data from old MySQL database

我最近将Java EE网络应用(在MySQL数据库上运行)转至铁路3.1。 现在的问题是,新申请的数据库模式与旧应用模式并不相同,因为I 增值,删除并改称一些属性。 数据库表名称也不同。

是否有办法迁移这些数据? 我可以想象的唯一办法是,用许多ALTER TABLE和CLATE TABLE声明撰写储存的程序,以更新数据库,使其符合新的模式。

先进。

:

我最后使用了INSERT。 计算机数据交换程序记录显示数据迁移情况。 INSERT INTO New_schema.new_table SlectT from original_schema.old_table. 现在,我正在考虑作出一项ake忙的任务,呼吁这一程序,并作出其他努力。

最佳回答

唯一的方式是写出从旧版b中获取数据并在新版b中添加me。 或者,你能够以某种方式与这两个数据库连接,然后选择并添加询问,例如,

 insert into new_db.table as select old_db.table.field1, ....

or

 insert into new_db.table (field_1, field_2) values (select old_db.table.field_1, ...)

无论如何,是一种手工操作过程,如果能够自动地将某些程序扩展至附有文字的延伸。

问题回答

不要使用我sql的Schema信息,在铁路线内使用铁路和一些锡克l。

sql = ActiveRecord::Base.connection()
old_tables = sql.execute "select table_name from information_schema.tables where table_schema = your_old_schema"
res.each do | old_table|
  old_fields = sql.execute "select distinct column_name, data_type from information_schema.columns where table_name= #{old_table}  and table_schema= your_old_schema "
  new_fields = sql.execute "select distinct column_name, data_type from information_schema.columns where table_name= #{old_table}  and table_schema= your_new_schema "
  #compare fields and so on...
end




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签