Database in a jar file

I have an application packaged in a .jar executable. It connects to an Access database using the JDBC-ODBC bridge, so I have the data source set up on my PC, all this works fine.
My question is how would I go about putting the database into the .jar executable so my files can access it without a user haveing to set up a datasource on thier PC?
Thanks for any help

I don't think you are going to be able to reach into a jar and do random access to one of the files inside of it. That's essentially what databases do. So while you might be able to put an .mdb file into a zip, you are going to have to get it out and onto the users hard drive to do anything with it.
Here's a link which talks a little about that (and web start too)
http://forum.java.sun.com/thread.jsp?forum=38&thread=242403
Now that you have an access file, you've got to talk to it. If you don't want to have a DSN, you can either go DSNless
http://forum.java.sun.com/thread.jsp?forum=31&thread=297824
or use an MSaccess JDBC driver
http://servlet.java.sun.com/products/jdbc/drivers

Similar Messages

  • Please help, cannot connect to Access database with a jar file

    Hi, i created a jar file from my java project, using eclipse.
    When i try open the jar through command prompt, the following error is given:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Could not find
    file '(unknown)'.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at Methods.con(Methods.java:15)
    at LoginScreen.getCmboLogins(LoginScreen.java:80)
    at LoginScreen.getJContentPane(LoginScreen.java:65)
    at LoginScreen.initialize(LoginScreen.java:46)
    at LoginScreen.<init>(LoginScreen.java:31)
    at DataUse.main(DataUse.java:25)
    No Connection to dataBASE
    The program runs fine within eclipse and the database is bundled in the jar.

    rohangr wrote:
    The program runs fine within eclipse Because the database isn't in the jar.
    ...and the database is bundled in the jar.That isn't going to work.
    The MS ODBC driver (which has absolutely nothing to do with java) expects to find the MS Access file in the windows file system.
    And the contents of the jar file does not fit into that requirement.

  • Unable to load database driver from my applet's jar file

    I'm trying to set up an applet that will talk to a MySQL database. I have no problem connecting to the database as I'm developing the code ("un-jarred"), but when I create a jar file of my code to test through a web browser, I cannot connect to the database due to the usual ClassNotFoundException. I have included mysql-connector-java-3.1.12-bin.jar (the current driver) in the jar, but I don't know if I'm supposed to supply some info through an attribute to the applet tag to let it know that the jar contains the driver it needs or if I have to call the driver differently in my code.
    Any help is appreciated, thanks.

    The simplest approach is always the best. :)Abso-lutely.
    Awesome, that worked perfectly. I Included the extra
    jar file in the applet tag and now my applet makes
    some sweet lovin' to the database.And you have succeeded where thousands have failed. Congratulations.

  • Problem while loading a jar file into database

    Hi All,
    We are using Oracle 8.1.5 in Solaris. When I try to load a jar file into the database by using loadjava it gives the following error
    Error while processing jar cryptix32.jar
    Exception java.io.IOException: Load Java is unable to handle compressed entries: cryptix/provider/Cryptix.class
    loadjava: 1 errors
    Can anybody suggest anything to overcome this. Thanks in advance.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by John Emmer ([email protected]):
    I presume you've tried creating the jar w/o compressing it? If not, and even if you didn't create the jar, then first unpack the jar into a directory and re-jar it without using compression.<HR></BLOCKQUOTE>
    Hi John,
    Thanks for your help. I unpacked the jar and rhen re-jared it with -0 (uncompress ) option. The above error is gone. But I am getting another problem. I am getting the following error for all the classes except the property files.
    Error while resolving class cryptix/cryptix/provider/cipher/Rijndael
    ORA-04043: object cryptix/cryptix/provider/cipher/Rijndael does not exist
    But the class is there in the jar. I am able to load single individual classes. Can anybody help me in this matter. Thanks in advance.

  • JAR file including database connection

    Hello,
    I made an application ( GUI ) which uses a MS acces Database.
    I used Netbeans, so a JAR file is automatically created.
    The only problem is that when I run the Jar file ,the application isn't able to find the connection with the database.
    Very annoying, but I do not know how to include it in my JAR file.
    Is it possible? Maybe not, because access is from windows, while JAR is independent of the running platform.
    If not, is it possible to make it run independently in another way, for example 'exe-file'.
    If yes, how?Any ideas...
    I've been looking for a couple of weeks, but never found a satisfying solution...
    I just want to be able to run the application without the need of netbeans.
    Thanks in advance.

    Thx for your quick replies!
    First of all , I will give you more details how I made connection with access. Beneath you find my class 'Database".
    Then, I made an object from that class and use it for example createStatements:
    {code}Statement stmt = db.getDbConnection().createStatement();{code} (db = object from class Database )
    {code}package database;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class Database {
    private Connection dbConnection;
    public Database(String file) {
    loadDriver();
    connectDatabase(file);
    private void loadDriver() {
    try
    Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
    catch (ClassNotFoundException err)
    System.out.println("Could not load driver ");
    System.exit(1);
    private void connectDatabase(String dbFile) {
    try
    String protocol ="jdbc";
    String subProtocol = "odbc";
    String subName ="Driver={Microsoft Access Driver (*.mdb)};DBQ= "+dbFile;
    String URL = protocol + ":" + subProtocol + ":" + subName;
         dbConnection = DriverManager.getConnection(URL);
    catch(SQLException error)
    System.err.println("Error connecting to database: " + error.toString());
    public void closeConnection() {
    try
    dbConnection.close();
    catch(SQLException error)
    System.err.println("Cannot disconnect database");
    public Connection getDbConnection(){
    return dbConnection;
    }{code}
    You said that the resources have to exist when you run it...Okay. In netbeans that's easy because it's part of java language and netbeans loads everything he needs... But how can I realise it to run without netbeans?
    Btw, it's no problem that the application is only runnable on windows. I was just wondering...
    If you need some more information, just ask. It's not always easy for me to understand what information a specialist like you needs ;-)

  • Required the details of jar files which is loaded in the database

    Hi
    We are having a 10g database which is running under Solaris machine. There are lot of .jar files which are loaded into the database. I would like to know how to find those .jar file details atlease the name of the files which are loaded in the database. Is there any view for this.
    I couldnt find anything from the Java option in TOAD
    Please provide a solution.
    Thanks
    SHIYAS M

    From 11g onwards, you have
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE 11.2.0.3.0 Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    SQL> desc javajar$
    Name Null? Type
    NAME NOT NULL VARCHAR2(30)
    OWNER# NOT NULL NUMBER
    PATH VARCHAR2(4000)
    CONTENTS BLOB
    SQL> desc javajarobjects$
    Name Null? Type
    JARNAME NOT NULL VARCHAR2(30)
    OWNER# NOT NULL NUMBER
    OBJNAME NOT NULL VARCHAR2(40)
    NAMESPACE NOT NULL NUMBER

  • Urgent: Does dbms_java package is required  to load jar file into database?

    Hi, It's a urgent request. I am trying to install jar file that was created by JDeveloper into database using loadjava. But it is giving so many errors.
    Do we need to install dbms_java package in order to load jar files into the database? Thanks.

    Thanks for your reply Kamal.
    I am trying to load these jar files into Oracle 9.2.0.3.20 database.
    Could you please give me the list of the steps to enable java within the database? Thanks.

  • Where do I put the .jar file for the database connection?

    I am trying to connect to an Oracle 11g database. I see under the coldfusion settings summary that the java version is 1.7.0_55. So I downloaded the ojdbc7.jar file from Abode.com. Now the question is where do I put it so that coldfusion can access it?
    Of course I need to set up the database connection (which I still don't have the connection string for), but I still need to know where to put the ojdbc.jar file.
    Thanks.

    jasonwryan wrote:What does the man page say?
           The  program  has builtin defaults and temperature thresholds but users
           can   specify   their   own    settings    in    configuration    files
           /etc/default/i8kmon  and  ~/.i8kmon.   The daemon defines 4 states with
           different fan speeds ({0 0}, {1 0}, {1 1}, {2 2}) and  for  each  state
           are  defined  the temperature thresholds which cause the switching to a
           higher or lower  state.  Furthermore  each  state  can  have  different
           thresholds  for operation on ac power or battery.  For example the fol‐
           lowing configuration:
    I've put the following file in /etc/default/i8kmon:
    # Run as daemon, override with --daemon option
    set config(daemon) 0
    # Automatic fan control, override with --auto option
    set config(auto) 1
    # Report status on stdout, override with --verbose option
    set config(verbose) 1
    # Status check timeout (seconds), override with --timeout option
    set config(timeout) 1
    # Temperature thresholds: {fan_speeds low_ac high_ac low_batt high_batt}
    set config(0) {{-1 0} -1 50 -1 50
    set config(1) {{-1 1} 50 70 50 70}
    set config(3) {{-1 2} 70 128 70 128}
    But it doesn't seem to do anything. I'm running a Dell Inspiron 3521 with no dedicated GPU, so it only has one fan. I was somehow able to get i8kmon to work in Ubuntu by putting this config in /etc/i8kmon, but can't get it to work in Arch. Putting it in /etc/i8kmon and /etc/default/i8kmon doesn't do anything.

  • How to list the JAR files loaded into the Oracle Database ?

    How to list the JAR files loaded into the Oracle Database ?

    From 11.1 onwards, the below two views are available to identify the jar files loaded into the Database.
    JAVAJAR$
    JAVAJAROBJECTS$
    By querying the JAVAJAR$ view you can know information about the JAR files loaded into the Database and using JAVAJAROBJECTS$ view you can find all the java objects associated with the given JAR file.
    These views are populated everytime you use LOADJAVA with "-jarsasdbobjects" option to load your custom java classes.
    But unfortunately this feature is available only from 11.1 onwards and there is no clear workaround for above in 10.2 or earlier.

  • Making executable jar file the database using JTable

    How can i make an executable jar file if I will use a JTable on my database?Can you tell me how?
    Thank you !!

    dantte wrote:
    in truth, ur question is not clear enough. elaborate on what exactly it is u want, and what u ar truin to achieve.You don't seem to know enough English, let along Java, to be answering questions here.
    %

  • How to access the database jar file using the derby 10.2.1.6 database ?

    Hi,
    How to access the database jar file using the derby 10.2.1.6 database ?
    I have used like below. And i am getting the following the error:
    "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.apache.derby.jdbc.EmbeddedDriver'
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)"
    My context.xml file looks like this:
    <Context crossContext="true">
    <Resource name="jdbc/derby" auth="Container"
    type="javax.sql.DataSource" driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
    url="jdbc:derby:jar(\CalypsoDemo\database.jar)samples"
    username="xxx" password="xxx" maxActive="20" maxIdle="10"
    maxWait="-1"/>
    </Context>
    What could be the reason.?
    Any suggestions will be appriciated.
    Thanks in Advance,
    Gana.

    ya, I have restarted. Can you please tell me whether the path which i am giving is right or not in the context file?
    Thanks,
    Gana.

  • Storing a JAR file in a database and then accessing it

    Is it possible to store a JAR file in a database and then access it like a normal jar that is on your classpath?
    I'm sure this is not possible but can you specify an XML schema in an XML document where the XML schema file lives in the jar but the xml file doesn't?
    Cheers.

    Hello,
    Is it possible to store a JAR file in a database and
    then access it like a normal jar that is on your
    classpath?
    Is it possible? Well, yeah, anything's possible ;-)
    Can you do it without a custom ClassLoader? No.
    I'm sure this is not possible but can you specify an
    XML schema in an XML document where the XML schema
    file lives in the jar but the xml file doesn't?See above. ;-)
    -Ron

  • How can  I include my database file into my jar file?

    Hi,
    I am doing several tests for the jar command....
    I tried to put the database file into my jar file, but when the program run, it just couldn't find the database file, so how may I include the database file into the jar file? Not only that, it also can't find the policy file etc.

    sorry, I think I found the solution, I should have had read the API more carefully.

  • Accessing a Derby database inside of a Jar file...

    Hello,
    I've browsed many threads that touch on aspects of this topic, but I still can't seem to figure this out. Here is my dilemma:
    [1] I have a simple application that stores some data using JavaDB.
    [2] Everything works fine when I bundle the app into a jar, as long as I leave my Database folder outside the jar
    [3] If I include the DB in the jar the app does not see it.
    [4] I can't just leave the folder outside the jar because I eventually plan on deploying the app as a Web Start program.
    The Dev guide on JavaDB says +"A database can be in one of many locations: in the current working directory, on the classpath, in a JAR file..."+, and this apparently can be set using the derby.system.home property. I currently use the following to set this property: System.setProperty("derby.system.home", ".myDatabase"); How would I need to change this to allow the app to find the database inside the jar? If this requires the DB to be read-only (which is fine with me), what properties need to be set to designate the DB as such?
    Any input would be greatly appreciated.

    Well, upon rereading the Derby Developer's Guide I found the information I sought in the section "Creating Derby databases for read-only use" (p.34-37). I'm still not 100% sure about how to do the Web Start implementation, but this should put me on the right track.
    [UPDATE IN CASE ANYONE STUMBLES UPON THIS THREAD] It seems that the issue with Web Start is that the database needs to be access a writable location for the temporary directory, so I presume web start would have to request disc-access privileges... something I'm trying to avoid.
    Edited by: CommanderSalamander on Nov 9, 2007 10:06 AM

  • After LOADing .jar file in to the oracle database  some classes r invalid

    Hi I have a .jar file to load it into the oracle database 11g.
    I use load java to load the .jar file.... I dont mention any resolver so I assume that all the .class files inside .jar are loaded as the schema user objects . Eg: if my schema is SCOTT they are loaded as SCOTT objects .. correct me if iam wrong because i see these lines on a site
    Many Java classes contain references to other classes, which is the essence of reusing code. A conventional Java virtual machine searches for classes, ZIP, and JAR files within the directories specified in the CLASSPATH. In contrast, the Oracle Java virtual machine searches database schemas for class objects. With Oracle, you load all Java classes within the database, so you might need to specify where to find the dependent classes for your Java class within the database.
    All classes loaded within the database are referred to as class schema objects and are loaded within certain schemas. All JVM classes, such as java.lang., are loaded within PUBLIC. If your classes depend upon other classes you have defined, you will probably load them all within your own schema. For example, if your schema is SCOTT, the database resolver (the database replacement for CLASSPATH) searches the SCOTT schema before PUBLIC. The listing of schemas to search is known as a resolver spec. Resolver specs are for each class, whereas in a classic Java virtual machine, CLASSPATH is global to all classes.*
    When locating and resolving the interclass dependencies for classes, the resolver marks each class as valid or invalid, depending on whether all interdependent classes are located. If the class that you load contains a reference to a class that is not found within the appropriate schemas, the class is listed as invalid. Unsuccessful resolution at runtime produces a "class not found" exception. Furthermore, runtime resolution can fail for lack of database resources if the tree of classes is very large.
    Now my question is that.... why are some of the classes becoming invalid... ?
    Edited by: learning_man on Mar 4, 2010 10:26 AM

    after loading class i see some additional characers prior to class name when i query user_objects and object_type='JAVA CLASS'

Maybe you are looking for

  • Problem in call transaction in interactive ALV

    Hi All I am displaying ALV report. I want to make it interactive. After clicking on REFBN (COBK-REFBN) it should open FB03 transaction. I am using followng code: CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING    i_callback_program                =

  • MacBook audio issues connecting to HDTV

    I have a MacBook 6.1. I want to watch it through my HDTV. I know there are lots of variables, so I hope I can be specific enough for advice. I bought the mini display port for HDMi; I plugged it into my computer and the HDMI into my TV and have no pr

  • SQL Server 7.0 = Oracle 8i

    I wanted to confirm whether Migration Workbench creates Oracle database while migrating. I have precreated database, but in Oracle Model database name is shows as the same as SQL Server database name. How can we use the existing database while migrat

  • Lightroom CC 2015 Running With Lightroom 5.

    I am working on a Macbook pro running Yosemite version 10.10.3.  I subscribe to Creative Cloud - to run Lightroom CC and Photoshop CC - but up to now I have also had a previously installed version of Lightroom 5 running which I used. I have not previ

  • Problems with magnetic charger not connecting

    I bought my MacBook Pro back in August, and haven't had any problems until now. When I plug in my charger, the little green light will come on, switch to orange, and after about two minutes or so, turn off. It turns off when I move, and I have to unp