📄 dbbean.java
字号:
// Decompiled by DJ v2.9.9.60 Copyright 2000 Atanas Neshkov Date: 2008/4/5 1:42:38
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: DbBean.java
package com.iCan;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.sql.*;
public class DbBean
{
public DbBean()
{
result = null;
}
public void setConn(String s)throws Exception
{
Class.forName("com.mysql.jdbc.Driver");
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url="jdbc:mysql://localhost:3306/webdis?user=root&password=123456";
Connection connection = DriverManager.getConnection(url);
connection.setAutoCommit(false);
conn = connection;
}
public ResultSet doSelect(String s)
throws SQLException, UnsupportedEncodingException
{
try
{
if(s!=null){
PreparedStatement preparedstatement = conn.prepareStatement(s, 1004, 1007);
result = preparedstatement.executeQuery();
}
}
catch(Exception exception)
{
System.out.println(exception);
}
return result;
}
public void doAdd(String s)
throws SQLException, UnsupportedEncodingException
{
try
{
PreparedStatement preparedstatement = conn.prepareStatement(s);
preparedstatement.executeUpdate();
preparedstatement.close();
conn.commit();
}
catch(Exception exception)
{
System.out.println(exception);
conn.rollback();
}
}
public void doUpdate(String s)
throws SQLException, UnsupportedEncodingException
{
try
{
PreparedStatement preparedstatement = conn.prepareStatement(s);
preparedstatement.executeUpdate();
preparedstatement.close();
conn.commit();
}
catch(Exception exception)
{
System.out.println(exception);
conn.rollback();
}
}
public void doDelete(String s)
throws SQLException, UnsupportedEncodingException
{
try
{
PreparedStatement preparedstatement = conn.prepareStatement(s);
preparedstatement.executeUpdate();
preparedstatement.close();
conn.commit();
}
catch(Exception exception)
{
System.out.println(exception);
conn.rollback();
}
}
public void close()
throws SQLException, UnsupportedEncodingException
{
conn.close();
}
public Connection conn;
ResultSet result;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -