Results 1 to 3 of 3
  1. #1
    nishant.4545 is offline Member
    Join Date
    Jul 2009
    Posts
    10
    Rep Power
    0

    Default using jdbc from a jar file

    Hello everyone,
    I have created an application using swing that uses jdbc. I have created the required database using ms access. I have created a jar file encapsulating all the necessary .class files as well as the database. But now I dont know how to register the database that is inside the jar with ODBC.
    Please help me..

  2. #2
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    You just pass the JDBC driver the path of the database when you initialise it. Either use getResource() to get the path in the jar, or remove the database file from the jar and try it that way. Assuming you have the correct JDBC driver installed.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  3. #3
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    I have reservations about what MS Access' Jet database engine, or whatever they call it now, is going to think about accessing something inside a JAR file. I doubt it will allow that. Even if it does, the database will be read only. Look at JavaDB/Derby as an alternative for Access.

Similar Threads

  1. jdbc (java.util.)Properties file
    By jon80 in forum JDBC
    Replies: 3
    Last Post: 04-05-2011, 08:55 AM
  2. JDBC for DB2
    By mostafa-sky in forum JDBC
    Replies: 1
    Last Post: 03-21-2009, 06:17 PM
  3. Replies: 0
    Last Post: 04-01-2008, 11:17 AM
  4. Jdbc
    By siwa in forum JDBC
    Replies: 4
    Last Post: 11-09-2007, 08:31 AM
  5. Replies: 0
    Last Post: 09-28-2007, 01:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •