idea中System.getProperty用法及配置

一、System.getProperty再idea中的用法如下,读取JVM中的系统属性。

System.getProperty("dev_test")

二、如何再idea中配置呢
在这里插入图片描述

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
// // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) // package com.core; import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; public class ConnDB { public Connection conn = null; public Statement stmt = null; public ResultSet rs = null; private static String propFileName = "/com/connDB.properties"; private static Properties prop = new Properties(); private static String dbClassName = "com.mysql.jdbc.Driver"; private static String dbUrl = "jdbc:mysql://127.0.0.1:3306/db_librarysys?user=root&password=aaaaaa&useUnicode=true"; public ConnDB() { try { InputStream in = this.getClass().getResourceAsStream(propFileName); prop.load(in); dbClassName = prop.getProperty("DB_CLASS_NAME"); dbUrl = prop.getProperty("DB_URL", dbUrl); } catch (Exception var2) { var2.printStackTrace(); } } public static Connection getConnection() { Connection conn = null; try { Class.forName(dbClassName).newInstance(); conn = DriverManager.getConnection(dbUrl); } catch (Exception var2) { var2.printStackTrace(); System.out.println("wgh:" + dbUrl); } if (conn == null) { System.err.println("警告: DbConnectionManager.getConnection() 获得数据库链接失败.\r\n\r\n链接类型:" + dbClassName + "\r\n链接位置1:" + dbUrl); } return conn; } public ResultSet executeQuery(String sql) { try { this.conn = getConnection(); this.stmt = this.conn.createStatement(1004, 1007); this.rs = this.stmt.executeQuery(sql); } catch (SQLException var3) { System.err.println(var3.getMessage()); } return this.rs; } public int executeUpdate(String sql) { boolean var2 = false; int result; try { this.conn = getConnection(); this.stmt = this.conn.createStatement(1004, 1007); result = this.stmt.executeUpdate(sql); } catch (SQLException var4) { result = 0; } return result; } public void close() { try { if (this.rs != null) { this.rs.close(); } if (this.stmt != null) { this.stmt.close(); } if (this.conn != null) { this.conn.close(); } } catch (Exception var2) { var2.printStackTrace(System.err); } } }
05-19
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值