参考:

https://dzone.com/articles/how-use-linkedin-market-your

表空间信息

https://coderanch.com/t/300498/databases/Java-find-List-tablespaces-database

getCatalogs()

存储过程

https://dev.mysql.com/doc/refman/5.7/en/routines-table.html

注释

https://dev.mysql.com/doc/refman/8.0/en/columns-table.html

外键

https://dev.mysql.com/doc/refman/5.5/en/constraint-foreign-key.html

 package com.dataconnect.test.util;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SchemaDetailsTest {
private static Logger log = LoggerFactory
.getLogger(SchemaDetailsTest.class);
public static void main(String args[]) throws Exception {
String databaseName = "myDbName";
String userName = "username";
String password = "password";
String mySQLPort = "3306";
String hostUrl = "127.0.0.1";
// Setup the connection with the DB
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://" + hostUrl
+ ":" + mySQLPort, userName, password);
// --- LISTING DATABASE SCHEMA NAMES ---
ResultSet resultSet = conn.getMetaData().getCatalogs();
while (resultSet.next()) {
log.info("Schema Name = " + resultSet.getString("TABLE_CAT"));
}
resultSet.close();
// --- LISTING DATABASE TABLE NAMES ---
String[] types = { "TABLE" };
resultSet = conn.getMetaData()
.getTables(databaseName, null, "%", types);
String tableName = "";
while (resultSet.next()) {
tableName = resultSet.getString(3);
log.info("Table Name = " + tableName);
}
resultSet.close();
// --- LISTING DATABASE COLUMN NAMES ---
DatabaseMetaData meta = conn.getMetaData();
resultSet = meta.getColumns(databaseName, null, tableName, "%");
while (resultSet.next()) {
log.info("Column Name of table " + tableName + " = "
+ resultSet.getString(4));
}
}
}

mysql 提取 schema,table,column names的更多相关文章

  1. Oracle :value too large for column "SCHEMA"."TABLE"."COLUMN" (actual: 519, maximum: 500)的解决方案

    原因:我是使用 CREATE TABLE XXX AS subquery 进行创建的数据表,主要是将相关的数据聚合在一起,然后通过导出为SQL脚本文件,进行导入到新库中,导致部分INSERT INTO ...

  2. mysql切换数据库提示警告:Reading table information for completion of table and column names

    登录数据库后,选择数据库时发现以下提示, mysql> use testReading table information for completion of table and column ...

  3. MySQL Reading table information for completion of table and column names

    打开数据库是发现提示: mysql> show databases; +--------------------+ | Database | +--------------------+ | b ...

  4. Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -

    mysql -A不预读数据库信息(use dbname 更快)—Reading table information for completion of table and column names Y ...

  5. 解决:Reading table information for completion of table and column names

    mysql -A不预读数据库信息(use dbname 更快)—Reading table information for completion of table and column names Y ...

  6. Reading table information for completion of table and column names

    mysql> use ad_detail_page;Reading table information for completion of table and column namesYou c ...

  7. msyql error: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A

    mysql> use mydb Reading table information for completion of table and column names You can turn o ...

  8. Replication-Replication Distribution Subsystem: agent xxxxxx failed. Column names in each table must be unique

    最近遇到一个关于发布订阅(Replication)的奇葩问题,特此记录一下这个案例.我们一SQL SERVER数据库服务器出现大量告警.告警信息如下所示: DESCRIPTION: Replicati ...

  9. MySQL 8 mysql system schema

    在大的分类上:mysql schema包括存储数据库对象元数据的数据字典表和用于其他操作目的的系统表 数据字典表和系统表一般使用InnoDB存储引擎 与之前的版本不同,数据字典表和系统表存储在数据目录 ...

随机推荐

  1. 解决 C# .NET WebClient WebRequest请求缓慢的问题

    [编程环境]Visual Studio 2010, NET4.0 [开发语言]C#, 理论上VB.NET等依赖.NET Framework框架的语言均受此影响 [问题描述] 使用HttpWebRequ ...

  2. JDBC 获取自动生成的主键

    为什么需要获取自动生成的主键 例如:

  3. CSP-201609-3 炉石传说

    问题描述 <炉石传说:魔兽英雄传>(Hearthstone: Heroes of Warcraft,简称炉石传说)是暴雪娱乐开发的一款集换式卡牌游戏(如下图所示).游戏在一个战斗棋盘上进行 ...

  4. ETCD授权认证

    export ETCDCTL_API=3 ENDPOINTS=localhost:2379 etcdctl --endpoints=${ENDPOINTS} role add root etcdctl ...

  5. HDU 1035 Robot Motion(dfs + 模拟)

    嗯... 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1035 这道题比较简单,但自己一直被卡,原因就是在读入mp这张字符图的时候用了scanf被卡. ...

  6. PAT T1004 To Buy or Not to Buy - Hard Version

    暴力搜索加剪枝~ #include<bits/stdc++.h> using namespace std; ; string t; string s[maxn]; int pos[maxn ...

  7. C# 读取和写入txt文件

    读取: 1.使用StreamReader读取文件,然后一行一行的输出 StreamReader sr = new StreamReader(path,Encoding.Default); String ...

  8. 吴裕雄 Bootstrap 前端框架开发——Bootstrap 排版:可滚动

    <!DOCTYPE html> <html> <head> <title>菜鸟教程(runoob.com)</title> <meta ...

  9. Codeforces Round #617 (Div. 3)A. Array with Odd Sum(水题)

    You are given an array aa consisting of nn integers. In one move, you can choose two indices 1≤i,j≤n ...

  10. Python数据类型-3 布尔类型

    布尔类型 对于错.0和1.正与反,都是传统意义上的布尔类型. 但在Python语言中,布尔类型只有两个值,True与False.请注意,是英文单词的对与错,并且首字母要大写,不能其它花式变型. 布尔值 ...