我的代码如下:[code="java"]
public class testSqlite {
/**
* @param args
*/
public static void main(String[] args) {
//String test =null;
try
{
Class cls = Class.forName("org.sqlite.JDBC");
System.out.println("cls is:"+cls);
//String path=ReadEnv.getSqlitePath();
//System.out.println("path is:"+"jdbc:sqlite:"+path);
//Connection conn = DriverManager.getConnection("jdbc:sqlite:"+path);
Connection conn = DriverManager.getConnection("jdbc:sqlite:"+"D:\\sqlite\\configbase");
Statement stmt = conn.createStatement();
ResultSet result = stmt.executeQuery("select * from hostconfig where hostdc='0A'");
//String test =null;
while (result.next())
{
System.out.println("result is:" +result.getString(1));
// test = result.getString(1);
}
result.close();
stmt.close();
conn.close();
}
catch(ClassNotFoundException e)
{
System.out.println("class is not found");
e.printStackTrace();
}
catch(SQLException e)
{
e.printStackTrace();
}
}
}
[/code]不知道啥原因,在unix环境下这代码到跑通了,在window下本机装了个sqlite却报out.of.memory错误。
[b]问题补充:[/b]
To sunson468:我是用的eclipse,驱动也加在应用程序的lib下,我用的是sqlitejdbc-v033-nested.jar驱动要设置Manifest吗,unix下为啥不用