Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8517351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:40:34+00:00 2026-06-11T05:40:34+00:00

I need to connect to a Sqlite database, I am using following code but

  • 0

I need to connect to a Sqlite database, I am using following code but I reckon it connects to a database in memory. how can I connect to a database on my disk.

        String sDriver = "org.sqlite.JDBC";
        String Database = "NyDatabase.sqlite";
        String sJdbc = "jdbc:sqlite";
        String sDbUrl = sJdbc + ":" + Database;
        Class.forName(sDriver);

        conn = DriverManager.getConnection(sDbUrl);
        Statement st = conn.createStatement();

        // result = st.executeQuery(Select).toString();
        rs = st.executeQuery(Select);
        while (rs.next()) {
            for (int i = 1; i <= 4; i++)
                result[i] = rs.getString(i);
        }
        conn.close();

                    } catch (SQLException e) {

                    e.printStackTrace();
            }
            catch(Exception e){
        e.printStackTrace();
            }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:40:35+00:00Added an answer on June 11, 2026 at 5:40 am

    You have to use the correct JDBC URL to specify the database file.

    See How to Specify Database Files in the documentation of the JDBC driver for SQLite (assuming that that’s the JDBC driver you’re using).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to connect to SAP and do a simple update but it will
So I've got a large database that I can't hold in memory at once.
I am building a ado.net wrapper that can connect with any database(supported by ADO.Net)basically
I need to connect to a SQL server 2000 from SQL server 2008. but
I'm using DBI to query a SQLite3 database. What I have works, but it
I need to connect to an asmx webservice using javascript. the webservice accepts and
I need to connect to a database on godaddy and insert some values. All
I need to connect to the middleware server using java URL and URLConnection classes
I am semi-new to C# but in particular using Sqlite within C#, currently I
I need connect to server git. http://help.github.com/win-set-up-git/ I do everything to the point, 4

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.