正在加载图片...
JDBC Code public static void JDBCexample(String dbid,String userid,String passwd) try (Connection conn DriverManager.getConnection( "jdbc:oracle:thin:@db.yale.edu:2000:univdb",userid,passwd); Statement stmt conn.createStatement(); ..Do Actual Work.... 3 catch (SQLException sqle){ System.out.printIn("SQLException :"sqle); NOTE:Above syntax works with Java 7,and JDBC 4 onwards. Resources opened in "try (....)"syntax ("try with resources")are automatically closed at the end of the try block Database System Concepts-6th Edition 5.7 @Silberschatz,Korth and SudarshanDatabase System Concepts - 6 5.7 ©Silberschatz, Korth and Sudarshan th Edition JDBC Code public static void JDBCexample(String dbid, String userid, String passwd) { try (Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@db.yale.edu:2000:univdb", userid, passwd); Statement stmt = conn.createStatement(); ) { … Do Actual Work …. } catch (SQLException sqle) { System.out.println("SQLException : " + sqle); } } NOTE: Above syntax works with Java 7, and JDBC 4 onwards. Resources opened in “try (….)” syntax (“try with resources”) are automatically closed at the end of the try block
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有