微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

SpiderDB 数据库结构扒取工具

程序名称:SpiderDB

授权协议: Apache

操作系统: 跨平台

开发语言: Java

SpiderDB 介绍

SpiderDB 是一个轻量级的数据库结构扒取工具,使用 Java 开发。它是一个简单的类库可根据数据库的表结构来生成 POJO
对象,使用简单,支持各种不同的数据库系统。

示例代码

DBCrawler dbCrawler = new DBCrawler(connection, ConfigEnum.MAXIMUM);
DataBase dataBase = dbCrawler.getDatabase();
System.out.println(“productName :” + dataBase.getProductName() + ” version:” +
dataBase.getProductVersion());

//Return Schemas
SchemaSet schemaSet = dataBase.getSchemaSet();
Set schemas = schemaSet.getSchemas();
//Iterate to Fetch the schema @R_792_4045@ion and Tables
for(Schema schema : schemas)
{
System.out.println(“SchemaName :” + schema.getSchamaName());
TableSet tableSet = schema.getTableSet();
Set

tables = tableSet.getTables();
//Iterate to fetch the tables
for(Table table : tables)
{
System.out.println(“tableName :” + table.getTableName());
PrimaryKey primaryKey = table.getPrimaryKey();
System.out.println(“pk_Name:”+primaryKey.getPkName() + ” PrimaryKey Columns:”
+ primaryKey.getColumns());

ColumnSet columnSet = table.getColumnSet();
System.out.println(“Table Columns:”+ columnSet.getColumns());

Set foreignKeys = table.getForeignKeys();
System.out.println(“foreignKeys:”+foreignKeys);
}
}

SpiderDB 官网

http://code.google.com/p/spiderdb/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐