In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Public class DataBaseMessage {
Public static void main (String [] args) {
GetMessage ()
}
Public static void getMessage () {
Connection connection = null
ResultSet rs = null
Try {
Connection = get connection
DatabaseMetaData dbMetaData = connection.getMetaData ()
System.out.println ("Database related Information:")
System.out.println ("known users:" + dbMetaData.getUserName ())
System.out.println ("comma-separated list of system functions:" + dbMetaData.getSystemFunctions ())
System.out.println ("comma-separated list of time and date functions:" + dbMetaData.getTimeDateFunctions ())
System.out.println ("comma-separated list of string functions:" + dbMetaData.getStringFunctions ())
System.out.println ("supplier's preferred term for 'schema':" + dbMetaData.getSchemaTerm ())
System.out.println ("URL:" + dbMetaData.getURL ())
System.out.println ("allow read-only:" + dbMetaData.isReadOnly ())
System.out.println ("Product name:" + dbMetaData.getDatabaseProductName ())
System.out.println ("version:" + dbMetaData.getDatabaseProductVersion ())
System.out.println ("name of the driver:" + dbMetaData.getDriverName ())
System.out.println ("driver version:" + dbMetaData.getDriverVersion ())
/ / query all the information of the t_file table
Rs = dbMetaData.getColumns (null, null, "Table name", null)
/ / get the information of each record in the t_file table
While (rs.next ()) {
System.out.println (); System.out.println ()
String column_name = rs.getString ("COLUMN_NAME")
String type_name = rs.getString ("TYPE_NAME")
Int column_size = rs.getInt ("COLUMN_SIZE")
Boolean is_nullable = rs.getBoolean ("IS_NULLABLE")
String column_def = rs.getString ("COLUMN_DEF")
System.out.println ("column_name:" + column_name+ "* type_name:" + type_name+ "* column_size:" + column_size+ "* is_nullable:" + is_nullable + "* column_def:" + column_def)
}
} catch (Exception e) {
E.printStackTrace ()
} finally {
Try {
/ / connection.close ()
/ / rs.close ()
} catch (Exception e2) {
E2.printStackTrace ()
}
}
}
}
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.