资源简介

吉林大学软件学院数据库程序开发试验源代码,采用DB2_ESC_97_x64和Eclipse编写,JDBC,内含实验报告,共十一次试验,完整代码,可执行

资源截图

代码片段和文件信息

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
/**
 * 任务1 将P171页程序片段补充完整
 * @author lenovo
 *
 */
public class MyJDBC {


 static { 

            try { 
             Class.forName(“com.ibm.db2.jcc.DB2Driver“); 
            }catch (Exception e){ 
                e.printStackTrace(); 
            } 
}

public static void main (String argv[]){ 

             try { 
              Connection con = null; 

                 String url = “jdbc:db2:sample“; 

                 if (argv.length == 0) { 

                  con = DriverManager.getConnection(url); 

                 }else if (argv.length == 2){ 

                  String userid =“LENOVO“; 
                     String passwd = “qwe321“; 
                     con = DriverManager.getConnection(urluseridpasswd); 
                 }else{ 

                  throw new Exception(“\n Usage: java MyJDBC[usernamepassword]\n“);
                 } 

                     java.sql.Statement stmt = con.createStatement(); 

                     ResultSet rs = stmt.executeQuery(“SELECT EMPNO LASTNAME “ + 

                                   “ FROM EMPLOYEE “  + 

                                   “ WHERE SALARY > 40000 “ ); 

                     while ( rs.next() ) { 

                        System.out.println(“empno = “ + rs.getString(1) + 

                                              “lastname = “ + rs.getString(2) ); 

                    } 

                     rs.close(); 
                  
                     stmt.close(); 
                  
                     con.close(); 
                  
                 } catch (Exception e) { 

                        e.printStackTrace(); 
                  
                 } 
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件     2629120  2015-10-18 12:37  实验报告_贾锋.doc
     目录           0  2015-09-15 21:45  DB2_Task_01\
     文件         476  2015-09-15 21:49  DB2_Task_01\.classpath
     文件         387  2015-09-15 21:45  DB2_Task_01\.project
     目录           0  2015-09-15 21:45  DB2_Task_01\.settings\
     文件         598  2015-09-15 21:45  DB2_Task_01\.settings\org.eclipse.jdt.core.prefs
     目录           0  2015-10-18 09:14  DB2_Task_01\bin\
     文件        2160  2015-10-18 09:14  DB2_Task_01\bin\MyJDBC.class
     目录           0  2015-09-15 21:45  DB2_Task_01\src\
     文件        1838  2015-09-15 21:52  DB2_Task_01\src\MyJDBC.java
     目录           0  2015-09-15 22:22  DB2_Task_02\
     文件         476  2015-09-15 22:23  DB2_Task_02\.classpath
     文件         387  2015-09-15 22:22  DB2_Task_02\.project
     目录           0  2015-09-15 22:22  DB2_Task_02\.settings\
     文件         598  2015-09-15 22:22  DB2_Task_02\.settings\org.eclipse.jdt.core.prefs
     目录           0  2015-10-18 09:14  DB2_Task_02\bin\
     文件        3379  2015-10-18 09:14  DB2_Task_02\bin\labstaff.class
     目录           0  2015-09-15 22:25  DB2_Task_02\src\
     文件        6833  2015-09-16 10:15  DB2_Task_02\src\labstaff.java
     目录           0  2015-09-15 22:36  DB2_Task_03\
     文件         476  2015-09-15 22:37  DB2_Task_03\.classpath
     文件         387  2015-09-15 22:36  DB2_Task_03\.project
     目录           0  2015-09-15 22:36  DB2_Task_03\.settings\
     文件         598  2015-09-15 22:36  DB2_Task_03\.settings\org.eclipse.jdt.core.prefs
     目录           0  2015-10-18 09:14  DB2_Task_03\bin\
     文件        3273  2015-10-18 09:14  DB2_Task_03\bin\labupdate.class
     目录           0  2015-09-15 22:37  DB2_Task_03\src\
     文件        2191  2015-09-21 16:22  DB2_Task_03\src\labupdate.java
     目录           0  2015-09-21 16:26  DB2_Task_04\
     文件         476  2015-09-21 16:26  DB2_Task_04\.classpath
     文件         387  2015-09-21 16:26  DB2_Task_04\.project
............此处省略140个文件信息

评论

共有 条评论