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

📄 connect2db.java

📁 JAVA环境下连数据的的简单示例代码(ACCESS)
💻 JAVA
字号:
/*
 * Created on 2007-6-28
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package com.ai.get24;
import java.sql.*;
/**
 * @author Vincent.Zhang
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class Connect2DB implements IfConnect2DB {

	public Connection conn;
	public Statement stmt;
	
	public Connect2DB(){
		CreateConnection();
	}
	
	public Statement CreateConnection(){
	    try{
		Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
		String dburl ="jdbc:odbc:AI1";
		conn=DriverManager.getConnection(dburl);
		stmt=conn.createStatement();
	    }catch(Exception e){
	    	System.out.print(e);
	    }
	    return stmt;
	}
	
	public void CloseConnection(){
		try{
		stmt.close();
		conn.close();
		}catch(Exception e){
		System.out.print(e);
	    }
	}
}

⌨️ 快捷键说明

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