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 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); return true; } catch(Exception e){ System.out.println( "executeSql------"+e.toString() ); return false; } }}
dbmanager java_dbmanager.java~36~ 源代码在线查看 - 希望对各位有所帮助 资源下载 虫虫电子下载站...
最新推荐文章于 2021-03-03 22:59:23 发布