📄 connections.java
字号:
package jsp.tags.dapact.samples;
import java.sql.*;
import jsp.tags.dapact.conf.UserClassFactory;
/**
* Title: Data Aware Processing And Control Tags
* Description: Tag library for the processing and controlling the input and output of data.
* Copyright: LGPL (http://www.gnu.org/copyleft/lesser.html)
* Compile Date: @compile_date@
* @author Allen M Servedio
* @amp_sign@version @VERSION@
*/
/**
* Modify this class to produce connections for your database.
*/
public class Connections
{
// This loads the database driver which will register itself with the DriverManager.
static
{
try
{
Class.forName("@DATABASE_DRIVER@");
}
catch (ClassNotFoundException e)
{
UserClassFactory.getLogger().log("Could not find the database driver class.", e);
}
}
/**
* Default constructor (not really needed...).
*/
private Connections()
{
}
/**
* @return Retrieve a connection - hard codes the URL, name and password.
*/
public static final Connection getConnection() throws SQLException
{
return DriverManager.getConnection("@DATABASE_URL@", "@DATABASE_USER_NAME@", "@DATABASE_USER_PASSWORD@");
}
/**
* @param conn the connection to release.
*/
public static final void releaseConnection(Connection conn) throws SQLException
{
if (conn != null)
{
conn.close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -