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

📄 msacces.java

📁 this is a java source code file.. download and enjoy of it...
💻 JAVA
字号:
package inc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
/*
 * MsAcces.java
 *
 * Created on April 11, 2007, 9:41 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

/**
 *
 * @author mamat-dev
 */
public class MsAcces {
    
    private String odbc,user,password,database;
    private Connection con;
    private Statement st;
    int jumBaris;
    
    /** Creates a new instance of MsAcces */
    public MsAcces() {
        this.odbc = "Driver={MicroSoft Access Driver (*.mdb)}";
        this.user = "";
        this.password ="";
        this.database = "D:/My Project/Java/web perpustakaan/source java/"+
                "tugas/web/perpustakaan.mdb";
    }
    
    public void getConnection() throws SQLException, ClassNotFoundException {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        this.con = DriverManager.getConnection("jdbc:odbc:"+ this.odbc +";DBQ=" + this.database,this.user,this.password);
    }
    
    public Statement getStatement() throws SQLException{
        this.st = this.con.createStatement();
        return this.st;
    }
    
    public void closeStatement() throws SQLException{
        this.st.close();
    }
    public void closeConnection() throws SQLException{
        this.con.close();
    }
}

⌨️ 快捷键说明

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