⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oradbgetmethod.java

📁 博克后台的开发,有很多使用的方法和例子可以提供给大家学习
💻 JAVA
字号:
package com.webpublish.dbutil;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;

import com.webpublish.dbutil.OradbUtil;
//import com.webpublish.config.ComStatic;

public class OradbGetMethod {

	//public OradbUtil oradbUtil = new OradbUtil("jdbc:oracle:thin:@192.168.0.101:1521:ora815", "db66user","cbznw68j");

	private ResultSet rs = null; // resultset object

	public OradbGetMethod() {
		System.out.println("hello---------------");
	}

	/*public int GetRecordCount(String Sqlstr) {
		int intRowCount = 0;
		try {
			rs = oradbUtil.executeQuery(Sqlstr);
			rs.last();
			intRowCount = rs.getRow();
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			try {
				if (rs != null) {
					rs.close();
					rs = null;
				}
			} catch (SQLException e) {
				System.out.println("OradbUtil close rs error!");
			}
		}
		return intRowCount;
	}*/

	public Vector getAllRecordId(Vector webArr, String sqlStr, long periodNumber) {
		Vector allRecordId = new Vector();
		OradbUtil OradbUtilPrepstmt = new OradbUtil(sqlStr);
		try {
			// for (int i = 0; i < webArr.size(); i++) {
			OradbUtilPrepstmt.setLong(1, periodNumber);
			OradbUtilPrepstmt.rs = OradbUtilPrepstmt.executeQuery();
			while (OradbUtilPrepstmt.rs.next()) {
				allRecordId.add(OradbUtilPrepstmt.rs.getString(1));
			}
			// }
		} catch (Exception e) {
			//ComStatic.GrainLog.logString = "执行查询语句:" + sqlStr + "时出错.";
			//ComStatic.GrainLog.errLog(e.toString());
		} finally {
			try {
				if (OradbUtilPrepstmt.rs != null) {
					OradbUtilPrepstmt.rs.close();
					OradbUtilPrepstmt.rs = null;
				}
			} catch (SQLException e) {
				System.out.println("OradbUtil close rs error!");
			}
		}
		return allRecordId;
	}

	public final ResultSet getItemDate(String sqlStr) {
		try {
			OradbUtil OradbUtilstmt = new OradbUtil(
					"jdbc:oracle:thin:@192.168.0.101:1521:ora815", "db66user",
					"cbznw68j");

			rs = OradbUtilstmt.executeQuery(sqlStr);
			System.out.println("sqlstr="+sqlStr);
			//System.out.println("rows1="+rs.getRow());
			while(rs.next())
			{
				System.out.println("rows1="+rs.getRow());
				System.out.println("id="+rs.getString(1));
			}
		} catch (SQLException e) {
			//ComStatic.GrainLog.logString = "执行查询语句:" + sqlStr + "时出错!";
			//ComStatic.GrainLog.errLog(e.toString());
		}
		return rs;
	}

	public final Vector getWebVector() {
		Vector webVector = new Vector();
		return webVector;
	}

	public static void main(String[] args) {
		OradbGetMethod togm = new OradbGetMethod();
		//String sqlStr = ComStatic.getDbConfig.getProperty("SelectAllRecordId");
       String sql="select * from db66_ymwh where nrmc='知识生活' order by xssj desc,lbid";
		togm.getItemDate(sql);
		//System.out.println(togm.GetRecordCount("select * from ydbuser.VWEB_KLSX where wzklpmod='自动' and BITAND(klzdptseq,127)<>0"));

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -