chsboy 2009-01-08 08:55
浏览 295
已采纳

java调用sqlite,报out.of.memory错误?

我的代码如下:[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下为啥不用

  • 写回答

3条回答 默认 最新

  • iteye_14436 2009-01-08 09:49
    关注

    sqlitejdbc-v033-nested.jar驱动好像需要一个DLL动态链接库的?

    你需要把那个DLL也加载的!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误