{"id":878,"date":"2022-11-27T03:56:04","date_gmt":"2023-03-01T23:26:01","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/index.php\/2023\/11\/30\/java%e3%81%aedatasource%e3%80%81jdbc%e3%81%aedatasource%e3%81%ae%e4%be%8b%e3%82%92%e7%a4%ba%e3%81%97%e3%81%be%e3%81%99%e3%80%82\/"},"modified":"2025-08-01T03:12:51","modified_gmt":"2025-07-31T18:12:51","slug":"java%e3%81%aedatasource%e3%80%81jdbc%e3%81%aedatasource%e3%81%ae%e4%be%8b%e3%82%92%e7%a4%ba%e3%81%97%e3%81%be%e3%81%99%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%aedatasource%e3%80%81jdbc%e3%81%aedatasource%e3%81%ae%e4%be%8b%e3%82%92%e7%a4%ba%e3%81%97%e3%81%be%e3%81%99%e3%80%82\/","title":{"rendered":"Java\u306eDataSource\u3001JDBC\u306eDataSource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002"},"content":{"rendered":"<p>Java\u306eDataSource\u3068JDBC\u306eDataSource\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306f\u3001Java\u30d7\u30ed\u30b0\u30e9\u30e0\u5185\u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u64cd\u4f5c\u3059\u308b\u305f\u3081\u306e\u65b9\u6cd5\u3067\u3059\u3002\u5148\u307b\u3069\u3082\u898b\u3066\u304d\u305f\u3088\u3046\u306b\u3001JDBC\u306eDriverManager\u3092\u4f7f\u7528\u3057\u3066\u3001\u30ea\u30ec\u30fc\u30b7\u30e7\u30ca\u30eb\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u63a5\u7d9a\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u5b9f\u969b\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306b\u304a\u3044\u3066\u306f\u3001\u63a5\u7d9a\u4ee5\u4e0a\u306e\u6a5f\u80fd\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<h2>Java\u306e\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9<\/h2>\n<p>\u307b\u3068\u3093\u3069\u306e\u5834\u5408\u3001\u79c1\u305f\u3061\u306f\u7de9\u3084\u304b\u306a\u9023\u643a\u6027\u3092\u6c42\u3081\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u7c21\u5358\u306b\u5207\u308a\u66ff\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u7ba1\u7406\u306e\u305f\u3081\u306e\u30b3\u30cd\u30af\u30b7\u30e7\u30f3\u30d7\u30fc\u30ea\u30f3\u30b0\u3084\u5206\u6563\u30b7\u30b9\u30c6\u30e0\u306e\u30b5\u30dd\u30fc\u30c8\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002JDBC\u306eDataSource\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5185\u3067\u3053\u308c\u3089\u306e\u6a5f\u80fd\u3092\u5fc5\u8981\u3068\u3059\u308b\u5834\u5408\u306b\u6700\u9069\u306a\u65b9\u6cd5\u3067\u3059\u3002Java\u306eDataSource\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306f\u3001javax.sql\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u5b58\u5728\u3057\u3001getConnection()\u3068getConnection(String str1, String str2)\u3068\u3044\u30462\u3064\u306e\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u3055\u308c\u305f\u30e1\u30bd\u30c3\u30c9\u3092\u5ba3\u8a00\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>JDBC\u306e\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9<\/h2>\n<p>\u7570\u306a\u308b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30d9\u30f3\u30c0\u30fc\u306f\u3001DataSource\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306e\u7570\u306a\u308b\u7a2e\u985e\u306e\u5b9f\u88c5\u3092\u63d0\u4f9b\u3059\u308b\u8cac\u4efb\u304c\u3042\u308a\u307e\u3059\u3002\u305f\u3068\u3048\u3070\u3001MySQL JDBC\u30c9\u30e9\u30a4\u30d0\u306fcom.mysql.jdbc.jdbc2.optional.MysqlDataSource\u30af\u30e9\u30b9\u3067DataSource\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306e\u57fa\u672c\u7684\u306a\u5b9f\u88c5\u3092\u63d0\u4f9b\u3057\u3001Oracle\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30c9\u30e9\u30a4\u30d0\u306foracle.jdbc.pool.OracleDataSource\u30af\u30e9\u30b9\u3067\u5b9f\u88c5\u3057\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u5b9f\u88c5\u30af\u30e9\u30b9\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b5\u30fc\u30d0\u30fc\u306e\u8a73\u7d30\u3068\u30e6\u30fc\u30b6\u30fc\u306e\u8a8d\u8a3c\u60c5\u5831\u3092\u63d0\u4f9b\u3059\u308b\u305f\u3081\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\u3053\u308c\u3089\u306eJDBC DataSource\u306e\u5b9f\u88c5\u30af\u30e9\u30b9\u304c\u63d0\u4f9b\u3059\u308b\u4ed6\u306e\u4e00\u822c\u7684\u306a\u6a5f\u80fd\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul class=\"post-ul\">\n<li>Caching of PreparedStatement for faster processing<\/li>\n<li>Connection timeout settings<\/li>\n<li>Logging features<\/li>\n<li>ResultSet maximum size threshold<\/li>\n<\/ul>\n<h3>JDBC \u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u306e\u4f8b<\/h3>\n<p>\u30b7\u30f3\u30d7\u30eb\u306aJDBC\u306e\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u306e\u4f8b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002MySQL\u3068Oracle\u306e\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u306e\u57fa\u672c\u7684\u306a\u5b9f\u88c5\u30af\u30e9\u30b9\u3092\u4f7f\u7528\u3057\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u63a5\u7d9a\u65b9\u6cd5\u3092\u5b66\u3073\u307e\u3059\u3002\u6700\u7d42\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306f\u4ee5\u4e0b\u306e\u753b\u50cf\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>Java\u306eJDBC\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9 &#8211; \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/h3>\n<p>\u4f8b\u984c\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u5165\u308b\u524d\u306b\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a\u3068\u30c6\u30fc\u30d6\u30eb\u3001\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\u304c\u5fc5\u8981\u3067\u3059\u3002\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306fMySQL\u3084Oracle\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u7bc4\u56f2\u5916\u306a\u306e\u3067\u3001\u5358\u306b\u30c6\u30fc\u30d6\u30eb\u3068\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>--Create Employee table\r\nCREATE TABLE `Employee` (\r\n  `empId` int(10) unsigned NOT NULL,\r\n  `name` varchar(10) DEFAULT NULL,\r\n  PRIMARY KEY (`empId`)\r\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r\n\r\n-- insert some sample data\r\nINSERT INTO `Employee` (`empId`, `name`)\r\nVALUES\r\n\t(1, 'Pankaj'),\r\n\t(2, 'David');\r\n\r\ncommit;\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>CREATE TABLE \"EMPLOYEE\"\r\n  (\r\n    \"EMPID\"   NUMBER NOT NULL ENABLE,\r\n    \"NAME\"    VARCHAR2(10 BYTE) DEFAULT NULL,\r\n    PRIMARY KEY (\"EMPID\")\r\n  );\r\n\r\nInsert into EMPLOYEE (EMPID,NAME) values (10,'Pankaj');\r\nInsert into EMPLOYEE (EMPID,NAME) values (5,'Kumar');\r\nInsert into EMPLOYEE (EMPID,NAME) values (1,'Pankaj');\r\ncommit;\r\n<\/code><\/pre>\n<p>\u3055\u3066\u3001Java\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u79fb\u308a\u307e\u3057\u3087\u3046\u3002\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a\u3092\u758e\u7d50\u5408\u306b\u3059\u308b\u305f\u3081\u3001\u30d7\u30ed\u30d1\u30c6\u30a3\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002db.properties\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>#mysql DB properties\r\nMYSQL_DB_DRIVER_CLASS=com.mysql.jdbc.Driver\r\nMYSQL_DB_URL=jdbc:mysql:\/\/localhost:3306\/UserDB\r\nMYSQL_DB_USERNAME=scdev\r\nMYSQL_DB_PASSWORD=scdev123\r\n\r\n#Oracle DB Properties\r\nORACLE_DB_DRIVER_CLASS=oracle.jdbc.driver.OracleDriver\r\nORACLE_DB_URL=jdbc:oracle:thin:@localhost:1521:orcl\r\nORACLE_DB_USERNAME=hr\r\nORACLE_DB_PASSWORD=oracle\r\n<\/code><\/pre>\n<p>\u30ed\u30fc\u30ab\u30eb\u306a\u8a2d\u5b9a\u3068\u4e00\u81f4\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u307e\u305f\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30d3\u30eb\u30c9\u30d1\u30b9\u306bMySQL\u3068Oracle DB\u306eJDBC JAR\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u3053\u3068\u3082\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>Java JDBC \u30c7\u30fc\u30bf\u30bd\u30fc\u30b9 &#8211; MySQL\u3001Oracle \u306e\u4f8b<\/h3>\n<p>MySQL\u307e\u305f\u306fOracle\u306e\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3067\u304d\u308b\u30d5\u30a1\u30af\u30c8\u30ea\u30fc\u30af\u30e9\u30b9\u3092\u66f8\u3044\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.jdbc.datasource;\r\n\r\nimport java.io.FileInputStream;\r\nimport java.io.IOException;\r\nimport java.sql.SQLException;\r\nimport java.util.Properties;\r\n\r\nimport javax.sql.DataSource;\r\n\r\nimport oracle.jdbc.pool.OracleDataSource;\r\n\r\nimport com.mysql.jdbc.jdbc2.optional.MysqlDataSource;\r\n\r\npublic class MyDataSourceFactory {\r\n\r\n\tpublic static DataSource getMySQLDataSource() {\r\n\t\tProperties props = new Properties();\r\n\t\tFileInputStream fis = null;\r\n\t\tMysqlDataSource mysqlDS = null;\r\n\t\ttry {\r\n\t\t\tfis = new FileInputStream(\"db.properties\");\r\n\t\t\tprops.load(fis);\r\n\t\t\tmysqlDS = new MysqlDataSource();\r\n\t\t\tmysqlDS.setURL(props.getProperty(\"MYSQL_DB_URL\"));\r\n\t\t\tmysqlDS.setUser(props.getProperty(\"MYSQL_DB_USERNAME\"));\r\n\t\t\tmysqlDS.setPassword(props.getProperty(\"MYSQL_DB_PASSWORD\"));\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn mysqlDS;\r\n\t}\r\n\t\r\n\tpublic static DataSource getOracleDataSource(){\r\n\t\tProperties props = new Properties();\r\n\t\tFileInputStream fis = null;\r\n\t\tOracleDataSource oracleDS = null;\r\n\t\ttry {\r\n\t\t\tfis = new FileInputStream(\"db.properties\");\r\n\t\t\tprops.load(fis);\r\n\t\t\toracleDS = new OracleDataSource();\r\n\t\t\toracleDS.setURL(props.getProperty(\"ORACLE_DB_URL\"));\r\n\t\t\toracleDS.setUser(props.getProperty(\"ORACLE_DB_USERNAME\"));\r\n\t\t\toracleDS.setPassword(props.getProperty(\"ORACLE_DB_PASSWORD\"));\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (SQLException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn oracleDS;\r\n\t}\r\n\t\t\r\n}\r\n<\/code><\/pre>\n<p>Oracle\u3068MySQL\u306eDataSource\u306e\u5b9f\u88c5\u30af\u30e9\u30b9\u306f\u975e\u5e38\u306b\u4f3c\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u3089\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3001\u3044\u304f\u3064\u304b\u306e\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306e\u30b7\u30f3\u30d7\u30eb\u306a\u30c6\u30b9\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.jdbc.datasource;\r\n\r\nimport java.sql.Connection;\r\nimport java.sql.ResultSet;\r\nimport java.sql.SQLException;\r\nimport java.sql.Statement;\r\n\r\nimport javax.sql.DataSource;\r\n\r\npublic class DataSourceTest {\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\t\r\n\t\ttestDataSource(\"mysql\");\r\n\t\tSystem.out.println(\"**********\");\r\n\t\ttestDataSource(\"oracle\");\r\n\r\n\t}\r\n\r\n\tprivate static void testDataSource(String dbType) {\r\n\t\tDataSource ds = null;\r\n\t\tif(\"mysql\".equals(dbType)){\r\n\t\t\tds = MyDataSourceFactory.getMySQLDataSource();\r\n\t\t}else if(\"oracle\".equals(dbType)){\r\n\t\t\tds = MyDataSourceFactory.getOracleDataSource();\r\n\t\t}else{\r\n\t\t\tSystem.out.println(\"invalid db type\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tConnection con = null;\r\n\t\tStatement stmt = null;\r\n\t\tResultSet rs = null;\r\n\t\ttry {\r\n\t\t\tcon = ds.getConnection();\r\n\t\t\tstmt = con.createStatement();\r\n\t\t\trs = stmt.executeQuery(\"select empid, name from Employee\");\r\n\t\t\twhile(rs.next()){\r\n\t\t\t\tSystem.out.println(\"Employee ID=\"+rs.getInt(\"empid\")+\", Name=\"+rs.getString(\"name\"));\r\n\t\t\t}\r\n\t\t} catch (SQLException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}finally{\r\n\t\t\t\ttry {\r\n\t\t\t\t\tif(rs != null) rs.close();\r\n\t\t\t\t\tif(stmt != null) stmt.close();\r\n\t\t\t\t\tif(con != null) con.close();\r\n\t\t\t\t} catch (SQLException e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n}\r\n<\/code><\/pre>\n<p>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30af\u30e9\u30b9\u304c\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u56fa\u6709\u306e\u30af\u30e9\u30b9\u3068\u5b8c\u5168\u306b\u72ec\u7acb\u3057\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u76ee\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0\u304b\u3089\u57fa\u76e4\u3068\u306a\u308b\u5b9f\u88c5\u306e\u8a73\u7d30\u3092\u96a0\u3059\u3053\u3068\u304c\u3067\u304d\u3001\u7de9\u3044\u7d50\u5408\u3068\u62bd\u8c61\u5316\u306e\u5229\u70b9\u3092\u5f97\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4e0a\u8a18\u306e\u30c6\u30b9\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u51fa\u529b\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>Employee ID=1, Name=Pankaj\r\nEmployee ID=2, Name=David\r\n**********\r\nEmployee ID=10, Name=Pankaj\r\nEmployee ID=5, Name=Kumar\r\nEmployee ID=1, Name=Pankaj\r\n<\/code><\/pre>\n<h3>Apache Commons DBCP \u306e\u4f8b<\/h3>\n<p>\u4e0a\u8a18\u306eJava\u306eDataSource\u30d5\u30a1\u30af\u30c8\u30ea\u30fc\u30af\u30e9\u30b9\u3092\u898b\u308b\u3068\u30012\u3064\u306e\u4e3b\u8981\u306a\u554f\u984c\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>MySQL\u3068Oracle\u306e\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306e\u30d5\u30a1\u30af\u30c8\u30ea\u30af\u30e9\u30b9\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u305d\u308c\u305e\u308c\u306e\u30c9\u30e9\u30a4\u30d0API\u3068\u5f37\u304f\u7d50\u3073\u3064\u3044\u3066\u3044\u307e\u3059\u3002\u5c06\u6765\u7684\u306bOracle\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30b5\u30dd\u30fc\u30c8\u3092\u524a\u9664\u3057\u305f\u308a\u3001\u4ed6\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30b5\u30dd\u30fc\u30c8\u3092\u8ffd\u52a0\u3057\u305f\u308a\u3059\u308b\u5834\u5408\u3001\u30b3\u30fc\u30c9\u306e\u5909\u66f4\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>MySQL\u3068Oracle\u306e\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306e\u307b\u3068\u3093\u3069\u306e\u30b3\u30fc\u30c9\u306f\u4f3c\u3066\u304a\u308a\u3001\u552f\u4e00\u306e\u9055\u3044\u306f\u4f7f\u7528\u3057\u3066\u3044\u308b\u5b9f\u88c5\u30af\u30e9\u30b9\u3067\u3059\u3002<\/ol>\n<p>Apache Commons DBCP API\u306f\u3001\u79c1\u305f\u3061\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3068\u7570\u306a\u308bJDBC\u30c9\u30e9\u30a4\u30d0\u30fc\u306e\u9593\u306e\u62bd\u8c61\u5316\u30ec\u30a4\u30e4\u30fc\u3068\u3057\u3066\u6a5f\u80fd\u3059\u308bJava DataSource\u306e\u5b9f\u88c5\u3092\u63d0\u4f9b\u3059\u308b\u3053\u3068\u3067\u3001\u3053\u308c\u3089\u306e\u554f\u984c\u3092\u89e3\u6c7a\u3059\u308b\u306e\u306b\u5f79\u7acb\u3061\u307e\u3059\u3002Apache DBCP\u30e9\u30a4\u30d6\u30e9\u30ea\u306fCommons Pool\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u4f9d\u5b58\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u753b\u50cf\u306b\u793a\u3059\u3088\u3046\u306b\u30d3\u30eb\u30c9\u30d1\u30b9\u306b\u4e21\u65b9\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u4ee5\u4e0b\u306fBasicDataSource\u3092\u4f7f\u7528\u3057\u305fDataSource\u30d5\u30a1\u30af\u30c8\u30ea\u30fc\u30af\u30e9\u30b9\u306e\u5b9f\u88c5\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.jdbc.datasource;\r\n\r\nimport java.io.FileInputStream;\r\nimport java.io.IOException;\r\nimport java.util.Properties;\r\n\r\nimport javax.sql.DataSource;\r\n\r\nimport org.apache.commons.dbcp.BasicDataSource;\r\n\r\npublic class DBCPDataSourceFactory {\r\n\r\n\tpublic static DataSource getDataSource(String dbType){\r\n\t\tProperties props = new Properties();\r\n\t\tFileInputStream fis = null;\r\n\t\tBasicDataSource ds = new BasicDataSource();\r\n\t\t\r\n\t\ttry {\r\n\t\t\tfis = new FileInputStream(\"db.properties\");\r\n\t\t\tprops.load(fis);\r\n\t\t}catch(IOException e){\r\n\t\t\te.printStackTrace();\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\tif(\"mysql\".equals(dbType)){\r\n\t\t\tds.setDriverClassName(props.getProperty(\"MYSQL_DB_DRIVER_CLASS\"));\r\n            ds.setUrl(props.getProperty(\"MYSQL_DB_URL\"));\r\n            ds.setUsername(props.getProperty(\"MYSQL_DB_USERNAME\"));\r\n            ds.setPassword(props.getProperty(\"MYSQL_DB_PASSWORD\"));\r\n\t\t}else if(\"oracle\".equals(dbType)){\r\n\t\t\tds.setDriverClassName(props.getProperty(\"ORACLE_DB_DRIVER_CLASS\"));\r\n            ds.setUrl(props.getProperty(\"ORACLE_DB_URL\"));\r\n            ds.setUsername(props.getProperty(\"ORACLE_DB_USERNAME\"));\r\n            ds.setPassword(props.getProperty(\"ORACLE_DB_PASSWORD\"));\r\n\t\t}else{\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\t\r\n\t\treturn ds;\r\n\t}\r\n}\r\n<\/code><\/pre>\n<p>\u30e6\u30fc\u30b6\u30fc\u306e\u5165\u529b\u306b\u5fdc\u3058\u3066\u3001MySQL\u307e\u305f\u306fOracle\u306e\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u304c\u4f5c\u6210\u3055\u308c\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30671\u3064\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u307f\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u3053\u308c\u3089\u306e\u30ed\u30b8\u30c3\u30af\u306f\u5fc5\u8981\u3042\u308a\u307e\u305b\u3093\u3002\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u5909\u66f4\u3059\u308b\u3060\u3051\u3067\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b5\u30fc\u30d0\u30fc\u3092\u5207\u308a\u66ff\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002Apache DBCP\u304c\u62bd\u8c61\u5316\u3092\u63d0\u4f9b\u3059\u308b\u9375\u70b9\u306f\u3001setDriverClassName()\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002\u3053\u3053\u306b\u306f\u3001\u4e0a\u8a18\u306e\u30d5\u30a1\u30af\u30c8\u30ea\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u7570\u306a\u308b\u30bf\u30a4\u30d7\u306e\u63a5\u7d9a\u3092\u53d6\u5f97\u3059\u308b\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.jdbc.datasource;\r\n\r\nimport java.sql.Connection;\r\nimport java.sql.ResultSet;\r\nimport java.sql.SQLException;\r\nimport java.sql.Statement;\r\n\r\nimport javax.sql.DataSource;\r\n\r\npublic class ApacheCommonsDBCPTest {\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\ttestDBCPDataSource(\"mysql\");\r\n\t\tSystem.out.println(\"**********\");\r\n\t\ttestDBCPDataSource(\"oracle\");\r\n\t}\r\n\r\n\tprivate static void testDBCPDataSource(String dbType) {\r\n\t\tDataSource ds = DBCPDataSourceFactory.getDataSource(dbType);\r\n\t\t\r\n\t\tConnection con = null;\r\n\t\tStatement stmt = null;\r\n\t\tResultSet rs = null;\r\n\t\ttry {\r\n\t\t\tcon = ds.getConnection();\r\n\t\t\tstmt = con.createStatement();\r\n\t\t\trs = stmt.executeQuery(\"select empid, name from Employee\");\r\n\t\t\twhile(rs.next()){\r\n\t\t\t\tSystem.out.println(\"Employee ID=\"+rs.getInt(\"empid\")+\", Name=\"+rs.getString(\"name\"));\r\n\t\t\t}\r\n\t\t} catch (SQLException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}finally{\r\n\t\t\t\ttry {\r\n\t\t\t\t\tif(rs != null) rs.close();\r\n\t\t\t\t\tif(stmt != null) stmt.close();\r\n\t\t\t\t\tif(con != null) con.close();\r\n\t\t\t\t} catch (SQLException e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n}\r\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u51fa\u529b\u306f\u4ee5\u524d\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3068\u540c\u3058\u306b\u306a\u308a\u307e\u3059\u3002Java\u306eJDBC\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3068\u4e0a\u8a18\u306e\u4f7f\u7528\u65b9\u6cd5\u3092\u898b\u308b\u3068\u3001\u901a\u5e38\u306e\u30c9\u30e9\u30a4\u30d0\u30fc\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3067\u3082\u540c\u3058\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002Java\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u306e\u4e3b\u306a\u5229\u70b9\u306f\u3001\u305d\u308c\u304c\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3068JNDI\u5185\u3067\u4f7f\u7528\u3055\u308c\u308b\u5834\u5408\u3067\u3059\u3002\u7c21\u5358\u306a\u8a2d\u5b9a\u3067\u3001\u30b3\u30f3\u30c6\u30ca\u81ea\u4f53\u304c\u7dad\u6301\u3059\u308b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u30d7\u30fc\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u307b\u3068\u3093\u3069\u306e\u30b5\u30fc\u30d6\u30ec\u30c3\u30c8\u30b3\u30f3\u30c6\u30ca\uff08Tomcat\u3084JBoss\u306a\u3069\uff09\u306f\u3001\u72ec\u81ea\u306eJava\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u5b9f\u88c5\u3092\u63d0\u4f9b\u3057\u3066\u304a\u308a\u3001\u7c21\u5358\u306aXML\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a\u3092\u4ecb\u3057\u3066\u8a2d\u5b9a\u3057\u3001JNDI\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30eb\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u4f7f\u7528\u3057\u3066Java\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3092\u53d6\u5f97\u3057\u3066\u4f7f\u7528\u3059\u308b\u3060\u3051\u3067\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u63a5\u7d9a\u30d7\u30fc\u30ea\u30f3\u30b0\u3084\u7ba1\u7406\u3092\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5074\u304b\u3089\u30b5\u30fc\u30d0\u30fc\u5074\u3067\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u305f\u3081\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d3\u30b8\u30cd\u30b9\u30ed\u30b8\u30c3\u30af\u306e\u8a18\u8ff0\u306b\u3088\u308a\u591a\u304f\u306e\u6642\u9593\u3092\u78ba\u4fdd\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u6b21\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001Tomcat\u30b3\u30f3\u30c6\u30ca\u3067\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3092\u8a2d\u5b9a\u3057\u3001Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\u3092\u5b66\u3073\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java\u306eDataSource\u3068JDBC\u306eDataSource\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306f\u3001Java\u30d7\u30ed\u30b0\u30e9\u30e0\u5185\u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u64cd\u4f5c\u3059\u308b\u305f\u3081\u306e\u65b9\u6cd5\u3067\u3059\u3002\u5148\u307b\u3069\u3082\u898b\u3066\u304d\u305f\u3088\u3046\u306b\u3001JDBC\u306eDriverManager\u3092\u4f7f\u7528\u3057\u3066\u3001\u30ea\u30ec\u30fc\u30b7 [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[26,61],"class_list":["post-878","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-26","tag-61"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Java\u306eDataSource\u3001JDBC\u306eDataSource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"Java\u306eDataSourceJDBC\u306eDataSource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/ja\/blog\/java\u306edatasource\u3001jdbc\u306edatasource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java\u306eDataSource\u3001JDBC\u306eDataSource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002\" \/>\n<meta property=\"og:description\" content=\"Java\u306eDataSourceJDBC\u306eDataSource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/java\u306edatasource\u3001jdbc\u306edatasource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-01T23:26:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-31T18:12:51+00:00\" \/>\n<meta name=\"author\" content=\"\u7dbe\u4e43, \u4e00\u5e0c\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u7dbe\u4e43, \u4e00\u5e0c\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"21\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%aedatasource%e3%80%81jdbc%e3%81%aedatasource%e3%81%ae%e4%be%8b%e3%82%92%e7%a4%ba%e3%81%97%e3%81%be%e3%81%99%e3%80%82\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%aedatasource%e3%80%81jdbc%e3%81%aedatasource%e3%81%ae%e4%be%8b%e3%82%92%e7%a4%ba%e3%81%97%e3%81%be%e3%81%99%e3%80%82\/\",\"name\":\"Java\u306eDataSource\u3001JDBC\u306eDataSource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2023-03-01T23:26:01+00:00\",\"dateModified\":\"2025-07-31T18:12:51+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/601389077b7f4e4ad6115428e3b73bff\"},\"description\":\"Java\u306eDataSourceJDBC\u306eDataSource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%aedatasource%e3%80%81jdbc%e3%81%aedatasource%e3%81%ae%e4%be%8b%e3%82%92%e7%a4%ba%e3%81%97%e3%81%be%e3%81%99%e3%80%82\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%aedatasource%e3%80%81jdbc%e3%81%aedatasource%e3%81%ae%e4%be%8b%e3%82%92%e7%a4%ba%e3%81%97%e3%81%be%e3%81%99%e3%80%82\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%aedatasource%e3%80%81jdbc%e3%81%aedatasource%e3%81%ae%e4%be%8b%e3%82%92%e7%a4%ba%e3%81%97%e3%81%be%e3%81%99%e3%80%82\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\u306eDataSource\u3001JDBC\u306eDataSource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/601389077b7f4e4ad6115428e3b73bff\",\"name\":\"\u7dbe\u4e43, \u4e00\u5e0c\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2228fe98b71141214fb24fb1b5ae44f99bdfa0602bbd89b351f2acd49ece862d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/2228fe98b71141214fb24fb1b5ae44f99bdfa0602bbd89b351f2acd49ece862d?s=96&d=mm&r=g\",\"caption\":\"\u7dbe\u4e43, \u4e00\u5e0c\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/ayanokazuki\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%aedatasource%e3%80%81jdbc%e3%81%aedatasource%e3%81%ae%e4%be%8b%e3%82%92%e7%a4%ba%e3%81%97%e3%81%be%e3%81%99%e3%80%82\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Java\u306eDataSource\u3001JDBC\u306eDataSource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002 - Blog - Silicon Cloud","description":"Java\u306eDataSourceJDBC\u306eDataSource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/ja\/blog\/java\u306edatasource\u3001jdbc\u306edatasource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002\/","og_locale":"ja_JP","og_type":"article","og_title":"Java\u306eDataSource\u3001JDBC\u306eDataSource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002","og_description":"Java\u306eDataSourceJDBC\u306eDataSource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/java\u306edatasource\u3001jdbc\u306edatasource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-03-01T23:26:01+00:00","article_modified_time":"2025-07-31T18:12:51+00:00","author":"\u7dbe\u4e43, \u4e00\u5e0c","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u7dbe\u4e43, \u4e00\u5e0c","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"21\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%aedatasource%e3%80%81jdbc%e3%81%aedatasource%e3%81%ae%e4%be%8b%e3%82%92%e7%a4%ba%e3%81%97%e3%81%be%e3%81%99%e3%80%82\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%aedatasource%e3%80%81jdbc%e3%81%aedatasource%e3%81%ae%e4%be%8b%e3%82%92%e7%a4%ba%e3%81%97%e3%81%be%e3%81%99%e3%80%82\/","name":"Java\u306eDataSource\u3001JDBC\u306eDataSource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2023-03-01T23:26:01+00:00","dateModified":"2025-07-31T18:12:51+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/601389077b7f4e4ad6115428e3b73bff"},"description":"Java\u306eDataSourceJDBC\u306eDataSource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%aedatasource%e3%80%81jdbc%e3%81%aedatasource%e3%81%ae%e4%be%8b%e3%82%92%e7%a4%ba%e3%81%97%e3%81%be%e3%81%99%e3%80%82\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%aedatasource%e3%80%81jdbc%e3%81%aedatasource%e3%81%ae%e4%be%8b%e3%82%92%e7%a4%ba%e3%81%97%e3%81%be%e3%81%99%e3%80%82\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%aedatasource%e3%80%81jdbc%e3%81%aedatasource%e3%81%ae%e4%be%8b%e3%82%92%e7%a4%ba%e3%81%97%e3%81%be%e3%81%99%e3%80%82\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"Java\u306eDataSource\u3001JDBC\u306eDataSource\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website","url":"https:\/\/www.silicloud.com\/ja\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/601389077b7f4e4ad6115428e3b73bff","name":"\u7dbe\u4e43, \u4e00\u5e0c","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/2228fe98b71141214fb24fb1b5ae44f99bdfa0602bbd89b351f2acd49ece862d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2228fe98b71141214fb24fb1b5ae44f99bdfa0602bbd89b351f2acd49ece862d?s=96&d=mm&r=g","caption":"\u7dbe\u4e43, \u4e00\u5e0c"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/ayanokazuki\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%aedatasource%e3%80%81jdbc%e3%81%aedatasource%e3%81%ae%e4%be%8b%e3%82%92%e7%a4%ba%e3%81%97%e3%81%be%e3%81%99%e3%80%82\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/878","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=878"}],"version-history":[{"count":1,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/878\/revisions"}],"predecessor-version":[{"id":46141,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/878\/revisions\/46141"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=878"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}