日日操夜夜添-日日操影院-日日草夜夜操-日日干干-精品一区二区三区波多野结衣-精品一区二区三区高清免费不卡

公告:魔扣目錄網(wǎng)為廣大站長提供免費(fèi)收錄網(wǎng)站服務(wù),提交前請(qǐng)做好本站友鏈:【 網(wǎng)站目錄:http://www.ylptlb.cn 】, 免友鏈快審服務(wù)(50元/站),

點(diǎn)擊這里在線咨詢客服
新站提交
  • 網(wǎng)站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會(huì)員:747

通常,有關(guān)數(shù)據(jù)的數(shù)據(jù)稱為元數(shù)據(jù)。 DatabaseMetaData 接口提供了一些方法來獲取有關(guān)您所連接的數(shù)據(jù)庫的信息,例如數(shù)據(jù)庫名稱、數(shù)據(jù)庫驅(qū)動(dòng)程序版本、最大列長度等…

以下是一些方法DatabaseMetaData 類。

說明

方法
getDriverName() 檢索當(dāng)前 JDBC 驅(qū)動(dòng)程序的名稱
getDriverVersion() 檢索當(dāng)前 JDBC 驅(qū)動(dòng)程序的版本 td>
getUserName() 檢索用戶名。
getDatabaseProductName() 檢索當(dāng)前數(shù)據(jù)庫的名稱。
getDatabaseProductVersion() 檢索當(dāng)前數(shù)據(jù)庫的版本。
getNumericFunctions() 檢索數(shù)字函數(shù)列表此數(shù)據(jù)庫可用。
getStringFunctions() 檢索此數(shù)據(jù)庫可用的數(shù)值函數(shù)列表。 td>
getSystemFunctions() 檢索此數(shù)據(jù)庫可用的系統(tǒng)函數(shù)列表。
getTimeDateFunctions() 檢索此數(shù)據(jù)庫可用的時(shí)間和日期函數(shù)列表。
getURL() 檢索當(dāng)前數(shù)據(jù)庫的 URL。
supportsSavepoints() 驗(yàn)證當(dāng)前數(shù)據(jù)庫是否支持保存點(diǎn)
supportsStoredProcedures() 驗(yàn)證當(dāng)前數(shù)據(jù)庫的天氣支持存儲(chǔ)過程。
supportsTransactions() 驗(yàn)證當(dāng)前數(shù)據(jù)庫是否支持事務(wù)。

示例

以下示例演示 DatabaseMetaData 類的用法。

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
public class DatabaseMetadataExample {
   public static void main(String args[])throws Exception {
      //Getting the connection
      String mysqlUrl = "jdbc:mysql://localhost/sampleDB";
      Connection con = DriverManager.getConnection(mysqlUrl, "root", "password");
      System.out.println("Connection established......");

      //Creating the DatabaseMetaData object
      DatabaseMetaData dbMetadata = con.getMetaData();
      //invoke the supportsBatchUpdates() method.
      boolean bool = dbMetadata.supportsBatchUpdates();

      if(bool) {
         System.out.println("Underlying database supports batch updates");
      } else {
         System.out.println("Underlying database doesnt supports batch updates");
      }

      //Retrieving the driver name
      System.out.println(dbMetadata.getDriverName());
      //Retrieving the driver version
      System.out.println(dbMetadata.getDriverVersion());
      //Retrieving the user name
      System.out.println(dbMetadata.getUserName());
      //Retrieving the URL
      System.out.println(dbMetadata.getURL());
      //Retrieving the list of numeric functions
      System.out.println("Numeric functions: "+dbMetadata.getNumericFunctions());
      System.out.println("");
      //Retrieving the list of String functions
      System.out.println("String functions: "+dbMetadata.getStringFunctions());
      System.out.println("");
      //Retrieving the list of system functions
      System.out.println("System functions: "+dbMetadata.getSystemFunctions());
      System.out.println("");
      //Retrieving the list of time and date functions
      System.out.println("Time and Date funtions: "+dbMetadata.getTimeDateFunctions());
   }
}

登錄后復(fù)制

輸出

Connection established......
Underlying database supports batch updates
MySQL-AB JDBC Driver
mysql-connector-java-5.1.12 ( Revision: ${bzr.revision-id} )
root@localhost
jdbc:mysql://localhost/sampleDB
Numeric functions:
ABS,ACOS,ASIN,ATAN,ATAN2,BIT_COUNT,CEILING,COS,COT,DEGREES,EXP,FLOOR,LOG,LOG10,MAX
,MIN,MOD,PI,POW,POWER,RADIANS,RAND,ROUND,SIN,SQRT,TAN,TRUNCATE
String functions:
ASCII,BIN,BIT_LENGTH,CHAR,CHARACTER_LENGTH,CHAR_LENGTH,CONCAT,CONCAT_WS,CONV,ELT,E
XPORT_SET,FIELD,FIND_IN_SET,HEX,INSERT,INSTR,LCASE,LEFT,LENGTH,LOAD_FILE,LOCATE,LO
CATE,LOWER,LPAD,LTRIM,MAKE_SET,MATCH,MID,OCT,OCTET_LENGTH,ORD,POSITION,QUOTE,REPEA
T,REPLACE,REVERSE,RIGHT,RPAD,RTRIM,SOUNDEX,SPACE,STRCMP,SUBSTRING,SUBSTRING,SUBSTR
ING,SUBSTRING,SUBSTRING_INDEX,TRIM,UCASE,UPPER
System functions:
DATABASE,USER,SYSTEM_USER,SESSION_USER,PASSWORD,ENCRYPT,LAST_INSERT_ID,VERSION
Time and Date funtions:
DAYOFWEEK,WEEKDAY,DAYOFMONTH,DAYOFYEAR,MONTH,DAYNAME,MONTHNAME,QUARTER,WEEK,YEAR,H
OUR,MINUTE,SECOND,PERIOD_ADD,PERIOD_DIFF,TO_DAYS,FROM_DAYS,DATE_FORMAT,TIME_FORMAT
,CURDATE,CURRENT_DATE,CURTIME,CURRENT_TIME,NOW,SYSDATE,CURRENT_TIMESTAMP,UNIX_TIME
STAMP,FROM_UNIXTIME,SEC_TO_TIME,TIME_TO_SEC

登錄后復(fù)制

以上就是JDBC中的DatabaseMetaData是什么?其意義何在?的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注www.92cms.cn其它相關(guān)文章!

分享到:
標(biāo)簽:DatabaseMetaData JDBC 何在 意義
用戶無頭像

網(wǎng)友整理

注冊(cè)時(shí)間:

網(wǎng)站:5 個(gè)   小程序:0 個(gè)  文章:12 篇

  • 51998

    網(wǎng)站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會(huì)員

趕快注冊(cè)賬號(hào),推廣您的網(wǎng)站吧!
最新入駐小程序

數(shù)獨(dú)大挑戰(zhàn)2018-06-03

數(shù)獨(dú)一種數(shù)學(xué)游戲,玩家需要根據(jù)9

答題星2018-06-03

您可以通過答題星輕松地創(chuàng)建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學(xué)四六

運(yùn)動(dòng)步數(shù)有氧達(dá)人2018-06-03

記錄運(yùn)動(dòng)步數(shù),積累氧氣值。還可偷

每日養(yǎng)生app2018-06-03

每日養(yǎng)生,天天健康

體育訓(xùn)練成績?cè)u(píng)定2018-06-03

通用課目體育訓(xùn)練成績?cè)u(píng)定