jsp自定义标签下拉框
package com.soft.test;
import java.sql.*;
import sun.jdbc.odbc.ee.ConnectionPool;
public class BaseDao {
//定义数据源驱动
private static final String drive="oracle.jdbc.driver.OracleDriver";
//定义连接字符串
private static final String url="jdbc:oracle:thin:@10.72.240.34:1522:ffv2dev2";
//用户名
private static final String uid="produsr";
//密码
private static final String pwd="prod_123";
//获得连接
public static Connection getConnection()
{
Connection con=null;
try {
//加载驱动
Class.forName(drive);
//建立连接
con=DriverManager.getConnection(url,uid,pwd);
} catch (Exception e) {
e.printStackTrace();
}
return con;
}
//运行有结果,没有参数的sql语句
public static ResultSet ResultrunSelectSql(String sql)
{
Connection con=null;
PreparedStatement ps=null;
ResultSet res=null;
try
{
con=getConnection();
ps=con.prepareStatement(sql);
res=ps.executeQuery();
}
catch(Exception e)
{
e.printStackTrace();
}
return res;
}
//执行有结果有参数的sql语句
相关新闻>>
- 发表评论
-
- 最新评论 更多>>