📄 jdbc.java
字号:
// FrontEnd Plus GUI for JAD
// DeCompiled : jdbc.class
package jdbc;
import java.sql.*;
import java.util.Enumeration;
import java.util.Vector;
public class jdbc
{
private int inuse;
private int max;
private Vector connections;
public jdbc()
{
inuse = 0;
max = 9999;
connections = new Vector();
}
public synchronized void releaseConnection(Connection connection)
{
connections.addElement(connection);
inuse--;
}
public synchronized Connection getConnection()
{
Connection connection = null;
if(connections.size() > 0)
{
connection = (Connection)connections.elementAt(0);
connections.removeElementAt(0);
try
{
if(connection.isClosed())
connection = getConnection();
}
catch(SQLException sqlexception) { }
} else
if(max == 0 || inuse < max)
connection = newConnection();
if(connection != null)
inuse++;
return connection;
}
private Connection newConnection()
{
Connection connection = null;
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
}
catch(Exception exception) { }
try
{
connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=tech", "tech", "wushili");
}
catch(SQLException sqlexception)
{
sqlexception.printStackTrace();
return null;
}
return connection;
}
public synchronized void closeCon()
{
for(Enumeration enumeration = connections.elements(); enumeration.hasMoreElements();)
{
Connection connection = (Connection)enumeration.nextElement();
try
{
connection.close();
}
catch(SQLException sqlexception) { }
}
connections.removeAllElements();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -