学习东西不忘记下笔记:
dbhelper类,各种数据库都合适。
public classDBHelper {
//mysql数据库//public static final String url = "jdbc:mysql://127.0.0.1:3306/test";//public static final String name = "com.mysql.jdbc.Driver";//public static final String user = "root";//public static final String password = "******";
//Oracle数据库
public static final String url = "jdbc:oracle:thin:@127.0.0.1:1521:test";public static final String name = "oracle.jdbc.driver.OracleDriver";public static final String user = "test";public static final String password = "1";public Connection conn = null;public PreparedStatement pst = null;publicDBHelper(String sql) {try{
Class.forName(name);//指定连接类型
conn = DriverManager.getConnection(url, user, password);//获取连接
pst = conn.prepareStatement(sql)
如果觉得《java 连接oracle 字符集_Java连接Oracle数据库 编码格式转换》对你有帮助,请点赞、收藏,并留下你的观点哦!