获取一个Connection:
Connection conn = getHibernateTemplate().getSessionFactory().openSession().connection();
Statement st=conn.createStatement();
st.execute("select * from tablename");
最后关闭链接:
finally{
try{
if(st!=null)
st.close();
if(conn!=null)
conn.close();
}catch(SQLException e){
System.out.println(e.toString());
}
}