在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):uboger/LibraryManager开源软件地址(OpenSource Url):https://github.com/uboger/LibraryManager开源编程语言(OpenSource Language):Java 99.8%开源软件介绍(OpenSource Introduction):登录信息
登陆成功界面运行环境
使用技术
连接数据库代码
public class DbOp{
private static String driver="sun.jdbc.odbc.JdbcOdbcDriver";
/**
*jdbc:odbc:bookdb";
*数据库名称是 bookdb
*
**/
private static String url="jdbc:odbc:bookdb";
private static Connection con=null;
private DbOp(){
try{
if(con==null){
Class.forName(driver);
con=DriverManager.getConnection(url);
}
}catch(Exception e){
JOptionPane.showMessageDialog(null,"数据库未能打开!");
System.out.println(e.getMessage());
}
} 入口类
public void sureActionListener(ActionEvent le){
String user=text_user.getText();//从文本框得到输入的用户名和密码
String pass=text_pass.getText();
String is_admin="";
if(user.equals("")||pass.equals("")){
JOptionPane.showMessageDialog(null,"密码不能为空,请输入密码");
return;
}
try{
/**
*数据库核对密码是否正确,正确就登陆成功
*
*/
String sql="select * from user where username="+"'"+user+"'"+"and password="+"'"+pass+"'";
ResultSet rs=DbOp.executeQuery(sql);
if(rs.next()){
is_admin=rs.getString("is_admin");
}else{
JOptionPane.showMessageDialog(null,"Wrong that is UserNmae or Password ");
return;
}
GlobalVar.login_user=user;
ShowMain show=new ShowMain();
show.setRights(is_admin);
System.out.println("Successed");
dispose();
}catch(SQLException e){
JOptionPane.showMessageDialog(null,"the wrong from information");
}
} access 数据源配置
32位JDK及配置(注意:64位操作系统支持32位JDK,而32位操作系统不支持64位JDK安装)
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论