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

📄 dbconnectionmanager.java

📁 小区物业管理系统(java版) java swing + access 2003
💻 JAVA
字号:
/* * DBConnectionManager.java * * Created on 2006年4月22日, 上午11:10 * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package mySql;import java.sql.*;/** * * @author wang */public class DBConnectionManager {    private String driverName="sun.jdbc.odbc.JdbcOdbcDriver";//数据库驱动名    private String url="jdbc:odbc:wySystem";//定义连接的数据库url    private String user="admin";    private String password="admin";    /** Creates a new instance of DBConnectionManager */    public void setDriverName(String newDriverName){  //设置驱动名        driverName=newDriverName;    }    public String getDriverName(){ //获取驱动名        return driverName;    }    public void setUrl(String newUrl){ //设置连接数据库的url        url=newUrl;    }    public String getUrl(){ //获取url        return url;    }    public void setUser(String newUser){        user=newUser;    }    public String getUser(){        return user;    }    public void setPassword(String newPassword){        password=newPassword;    }    public String getPassword(){        return password;    }    public Connection getConnection(){ //获取数据库连接        try{            Class.forName(driverName);//加载数据库驱动            return DriverManager.getConnection(url,user,password);        }        catch(Exception e){            e.printStackTrace();            return null;        }    }} 

⌨️ 快捷键说明

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