package Manager;import java.sql.*;//import java.util.*;public class DBManager { ResultSet rs ; String strurl="jdbc:odbc:myProduct"; public DBManager() { } public ResultSet getResult(String sql){ try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ; Connection conn=DriverManager.getConnection(strurl) ; Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); ResultSet rs=stmt.executeQuery(sql); return rs; } catch(Exception e){ System.out.println( "getResult------"+e.toString() ); } return rs; } public boolean executeSql(String sql){ try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ; Connection conn=DriverManager.getConnection(strurl) ; Statement stmt=conn.createStatement(); stmt.executeUpdate(sql); conn.commit(); return true; } catch(Exception e){ System.out.println( "executeSql------"+e.toString() ); return false; } } }
dbmanager java_dbmanager.java~1~ 源代码在线查看 - 希望对各位有所帮助 资源下载 虫虫电子下载站...
最新推荐文章于 2022-07-12 14:32:42 发布