资源简介
PHPopen-lims-master.zip
代码片段和文件信息
package base;
import io.DBConfig;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
/**
* Basic Database IO.
* @author Roman Quiring
*/
public class Dblink
{
private static String dbms = DBConfig.get_config(“dbms“);;
private static String sqlDriver = DBConfig.get_config(“sqlDriver“);;
private static String dbServer = DBConfig.get_config(“dbServer“);
private static String dbPort = DBConfig.get_config(“dbPort“);
private static String dbName = DBConfig.get_config(“dbName“);;
private static String dbUser = DBConfig.get_config(“dbUser“);;
private static String dbPassword = DBConfig.get_config(“dbPassword“);;
/**
* Static constructor.
*/
static
{
initDB();
}
/**
* Initialises the connection to the Database.
*/
private static void initDB() {
try
{
Class.forName(sqlDriver);
}
catch (ClassNotFoundException e)
{
System.err.println(“JDBC driver could not be found!“);
e.printStackTrace();
return;
}
Connection connection = getDBConnection();
try
{
connection.close();
}
catch (SQLException e)
{
System.err.println(“An error occurred while establishing a connection to the database!“);
e.printStackTrace();
}
}
/**
* Returns a Connection object.
* @return Connection the connection object.
*/
private static Connection getDBConnection() {
Connection connection = null;
try
{
connection = DriverManager.getConnection(“jdbc:“+dbms+“://“+dbServer+“:“+dbPort+“/“+dbName dbUser dbPassword);
}
catch (SQLException e)
{
System.err.println(“Connection to database failed! Make sure the specifications in the config file are correct.“);
e.printStackTrace();
}
return connection;
}
/**
* Executes a SQL Statement on the database.
* @param sql the SQL statement.
* @return a ResultSet containing the results.
*/
public static ResultSet executeQuery(String sql)
{
ResultSet results = null;
Connection connection = getDBConnection();
try
{
Statement statement = connection.createStatement();
results = statement.executeQuery(sql);
connection.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
return results;
}
/**
* Executes a SQL Update on the database.
* @param sql the SQL statement.
*/
public static void updateQuery(String sql)
{
Connection connection = getDBConnection();
try
{
Statement statement = connection.createStatement();
statement.executeUpdate(sql);
connection.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
/**
* Executes a SQL Statement on the database and accepts additional parameters-
* @param sql the SQL statement.
* @param type FORWARD_ONLY SCROLL_SENSITIV
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-03-30 13:23 open-lims-master\
文件 31 2017-03-30 13:23 open-lims-master\.gitignore
文件 32069 2017-03-30 13:23 open-lims-master\LICENSE
文件 160 2017-03-30 13:23 open-lims-master\README
目录 0 2017-03-30 13:23 open-lims-master\filesystem\
目录 0 2017-03-30 13:23 open-lims-master\filesystem\groups\
目录 0 2017-03-30 13:23 open-lims-master\filesystem\groups\1\
文件 34 2017-03-30 13:23 open-lims-master\filesystem\groups\1\placeholder.txt
目录 0 2017-03-30 13:23 open-lims-master\filesystem\groups\10\
文件 34 2017-03-30 13:23 open-lims-master\filesystem\groups\10\placeholder.txt
目录 0 2017-03-30 13:23 open-lims-master\filesystem\groups\11\
文件 34 2017-03-30 13:23 open-lims-master\filesystem\groups\11\placeholder.txt
目录 0 2017-03-30 13:23 open-lims-master\filesystem\groups\2\
文件 34 2017-03-30 13:23 open-lims-master\filesystem\groups\2\placeholder.txt
目录 0 2017-03-30 13:23 open-lims-master\filesystem\groups\9\
文件 34 2017-03-30 13:23 open-lims-master\filesystem\groups\9\placeholder.txt
目录 0 2017-03-30 13:23 open-lims-master\filesystem\organisation_units\
文件 34 2017-03-30 13:23 open-lims-master\filesystem\organisation_units\placeholder.txt
目录 0 2017-03-30 13:23 open-lims-master\filesystem\projects\
文件 34 2017-03-30 13:23 open-lims-master\filesystem\projects\placeholder.txt
目录 0 2017-03-30 13:23 open-lims-master\filesystem\samples\
文件 34 2017-03-30 13:23 open-lims-master\filesystem\samples\placeholder.txt
目录 0 2017-03-30 13:23 open-lims-master\filesystem\temp\
文件 34 2017-03-30 13:23 open-lims-master\filesystem\temp\placeholder.txt
目录 0 2017-03-30 13:23 open-lims-master\filesystem\templates\
目录 0 2017-03-30 13:23 open-lims-master\filesystem\templates\OLDL\
文件 34 2017-03-30 13:23 open-lims-master\filesystem\templates\OLDL\placeholder.txt
目录 0 2017-03-30 13:23 open-lims-master\filesystem\templates\OLVDL\
文件 34 2017-03-30 13:23 open-lims-master\filesystem\templates\OLVDL\placeholder.txt
目录 0 2017-03-30 13:23 open-lims-master\filesystem\users\
目录 0 2017-03-30 13:23 open-lims-master\filesystem\users\1\
............此处省略2860个文件信息
- 上一篇:php实用指南PHP电子书
- 下一篇:.zip 源码
相关资源
- lfcms_php.zip
- 云呼服务器源码phpAPK正版授权云呼系
- HP_10bii_EMU_20121210.zip
- 基于PHP的图书借阅管理系统.zip
- php无限级分类实现评论及回复.rar
- PHP报价计算器仿土巴兔.7z
- wfphp订单系统,商业破解版,php源码,
- 基于php的酒店预订信息管理系统.zip
- PHPmysqlDreamweaver动态网站建设全站源码
- phpstorm2018.22018.1中文汉化包.zip
- PHP语音口令红包小程序源码.zip
- ThinkPHP官方资料合集.rar
- 价值数万PHP深度二次开发小说站源码
- zw_PHP(全149讲)课堂笔记.zip
- zw_Thinkphp小型商城的源码.zip
- php_manual_手册.chm
- PHPJM.zip
- 春哥微信万能表单系统PHP源码.zip
- 思途cms旅游系统商业版+完美破除授权
- ThinkPHP借贷超市V1.5三级分销金融超市
- PHP万能表单系统可用于招生报名,招
- 12人牛牛源码+带架设教程[php+mysql].r
- PHP新闻发布系统.zip
- 禾匠商城微擎版(WXAPP前端源码PHP后端
- 仿其他论坛做的UG10.0角色文件
- PHPExcel.zip
- ok.php
- ask.php
- kodExplorer.php
- php.txt
评论
共有 条评论