摘要: 1. 把h2-1.3.174.jar 复制到libs文件夹下面 是为了引用 h22. 数据库的连接,打开,读取数据必须在另一个线程中,不能在主线程,为什么,我也不知道 所以下面以新线程运行String tt="";//运行timer 发送数据 TimerTask task = new TimerTask(){ public void run() { try { Class.forName("org.h2.Driver"); //调用h2的驱动} catch (ClassNotFoundException e) { // TODO Auto-generat 阅读全文
posted @ 2014-01-20 15:13 爱编程hao123 阅读(771) 评论(0) 推荐(0) 编辑
摘要: 1.首先把h2-1.3.174.jar 文件引用到项目中 右键--属性---java构建路径---库---添加外部jar文件import java.awt.Button;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import org.h2.Driver;public class helloworld {/** * @param args * @throws ClassNotFoundException * @th. 阅读全文
posted @ 2014-01-20 14:28 爱编程hao123 阅读(1058) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/biyutong/archive/2011/12/22/2297690.html1.数据库连接的jdbc urlh2分嵌入模式和服务模式,根据不同的模式和情况。连接数据库jdbc url的写法不同连接内嵌模式的数据库"jdbc:h2:file:D:/test" 连接自定目录下的指定数据库"jdbc:h2:~/test" 连接默认目录下的指定数据库连接内存模式的数据库jdbc:h2:mem:test连接server模式的数据库jdbc:h2:tcp://localhost/~/testssl连接数据库jdbc: 阅读全文
posted @ 2014-01-20 13:46 爱编程hao123 阅读(1282) 评论(0) 推荐(0) 编辑