Hi, Alan:
By default,sqlite will open the database in your workspace directory, which
you could get by
System.getProperty("user.dir");
Let's assume you keep your sqlite database named "test" in a sub-directory
called "database".
you could access them by doing:
File databaseDir = new File(System.getProperty("user.dir"), "database");
Connection conn = DriverManager.getConnection("jdbc:sqlite:"
+ databaseDir + "/" + "test");
regards
ye
On Wed, Sep 10, 2008 at 10:56 AM, beand <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm new to SQLite and I need to know how to use the getConnection
> function to open a db file relative to the currently executing
> program. So normally the line is something like
>
> Connection conn = DriverManager.getConnection("jdbc:sqlite:
> \sample.db");
>
> But I need to be able to have it open the database file relative to
> the program files path which is executing the code. How do I specify
> this?
>
> Thanks,
> -Alan
> >
>
--
Ye Huang, Department of Informatics
University of Fribourg / Pérolles 2 - Bld de Pérolles 90
1700 Fribourg, Switzerland
e-mail: [EMAIL PROTECTED], [EMAIL PROTECTED]
http://diuf.unifr.ch/people/huangy/
Office: +41 26 429 65 95
--~--~---------~--~----~------------~-------~--~----~
Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en
To unsubscribe, send email to [EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---