欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Hsqldb In Memory

程序员文章站 2022-05-24 17:52:20
...

public static void main(String[] args)
{
Connection connection;

try
{
Class.forName("org.hsqldb.jdbcDriver");
connection=DriverManager.getConnection("jdbc:hsqldb:mem:demodb","sa","");
Statement st=null;
ResultSet rs=null;

st=connection.createStatement();

String sql1="create table cuser(username varchar(10))";
String sql2="insert into cuser(username) values('wanjun')";
String sql3="select * from cuser";

st.executeUpdate(sql1);
st.executeUpdate(sql2);

rs=st.executeQuery(sql3);

while(rs.next())
{
System.out.println(rs.getString(1));
}
}
catch (Exception e)
{
e.printStackTrace();
}

}
相关标签: hsqldb