• 大小: 2.52MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-13
  • 语言: Java
  • 标签: java  

资源简介

java sqlsrever 2008编写的课程设计大作业

资源截图

代码片段和文件信息

package myconnete;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class DBConnecte
{

    public static Connection Connecte()
    {
        String driverName=“com.microsoft.sqlserver.jdbc.SQLServerDriver“;
        String dbURL=“jdbc:sqlserver://localhost:1433;DatabaseName=SSMS“;
        String userName=“wx“;
        String userPwd=“123456“;
        Connection dbConn=null;
        try
        {
            Class.forName(driverName);
            System.out.println(“加载驱动成功!“);
        }
        catch(Exception e)
        {
            e.printStackTrace();
            System.out.println(“加载驱动失败!aaaa“);
        }
        try
        {
            dbConn=DriverManager.getConnection(dbURLuserName userPwd);
            System.out.println(“连接数据库成功!“);
        }
        catch(Exception e)
        {
            e.printStackTrace();
            System.out.print(“SQL Server连接失败!aaaaaaaa“);
        }
        return dbConn;
    }

    public static void closeobject(object obj)
    {
        if(obj != null)
        {
            if(obj instanceof ResultSet)
            {
                try
                {
                    ((ResultSet) obj).close();
                    System.out.println(“关闭数据库!“);
                }
                catch(SQLException e)
                {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

            if(obj instanceof PreparedStatement)
            {
                try
                {
                    ((PreparedStatement) obj).close();
                    System.out.println(“关闭数据库!“);
                }
                catch(SQLException e)
                {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

            if(obj instanceof Connection)
            {
                try
                {
                    ((Connection) obj).close();
                    System.out.println(“关闭数据库!“);
                }
                catch(SQLException e)
                {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件         169  2013-12-31 11:44  11王鑫\reademe.txt
     目录           0  2013-12-31 11:44  11王鑫\
     目录           0  2013-12-31 11:41  11王鑫\java\
     文件         365  2013-12-24 21:26  11王鑫\java\\.classpath
     文件         379  2013-12-24 21:25  11王鑫\java\\.project
     目录           0  2013-12-31 11:41  11王鑫\java\\.settings\
     文件         598  2013-12-24 21:25  11王鑫\java\\.settings\org.eclipse.jdt.core.prefs
     文件       21908  2013-12-26 01:02  11王鑫\java\\A.jpg
     文件       21717  2013-12-26 01:03  11王鑫\java\\B - 副本.jpg
     目录           0  2013-12-31 11:41  11王鑫\java\\bin\
     目录           0  2013-12-31 11:41  11王鑫\java\\bin\my_sql\
     文件        6079  2013-12-30 14:43  11王鑫\java\\bin\my_sql\LOGIN_chose.class
     文件         408  2013-12-30 14:43  11王鑫\java\\bin\my_sql\MAIN.class
     文件         849  2013-12-30 14:43  11王鑫\java\\bin\my_sql\MyTable.class
     文件        4411  2013-12-30 14:43  11王鑫\java\\bin\my_sql\Stu_Cou.class
     文件       12267  2013-12-30 14:43  11王鑫\java\\bin\my_sql\Stu_Glist.class
     文件        2687  2013-12-30 14:43  11王鑫\java\\bin\my_sql\Stuframe.class
     文件        3772  2013-12-30 14:43  11王鑫\java\\bin\my_sql\Teaframe.class
     文件        5006  2013-12-30 14:43  11王鑫\java\\bin\my_sql\Win_Cou.class
     文件        5934  2013-12-30 14:43  11王鑫\java\\bin\my_sql\Win_CouAdd.class
     文件       12387  2013-12-30 14:43  11王鑫\java\\bin\my_sql\Win_Glist.class
     文件        3826  2013-12-30 14:43  11王鑫\java\\bin\my_sql\WIN_main.class
     文件        6825  2013-12-30 14:43  11王鑫\java\\bin\my_sql\Win_Scoeradd.class
     文件        6975  2013-12-30 14:43  11王鑫\java\\bin\my_sql\Win_Scoredel.class
     文件        6978  2013-12-30 14:43  11王鑫\java\\bin\my_sql\Win_Scoreup.class
     文件        5000  2013-12-30 14:43  11王鑫\java\\bin\my_sql\Win_Stu.class
     文件        4933  2013-12-30 14:43  11王鑫\java\\bin\my_sql\Win_Tea.class
     目录           0  2013-12-31 11:41  11王鑫\java\\bin\myconnete\
     文件        2029  2013-12-30 14:43  11王鑫\java\\bin\myconnete\DBConnecte.class
     目录           0  2013-12-31 11:41  11王鑫\java\\bin\toolframe\
     文件        6793  2013-12-30 14:43  11王鑫\java\\bin\toolframe\CouAlter.class
............此处省略33个文件信息

评论

共有 条评论