• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Adding Database to application

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here i am using my database with in my application



/MultiFucntioner/src/main/TelephoneBook.mdb
My class is also in this main package

Multifunctioner is the application name
src is the folder
main is the package
Telephone.mdb is the database name

my database is in a package and in this same package i have my database class too
I am using this code to access the database


if i am using this code than it will run but when i am trying to make the jar eclipse will not include this so that i am using the Url




error what i an getting is

 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm fairly certain that ODBC needs an actual MDB file, not something that's inside of a jar file.
 
Vivek Moyal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the first code my application runs perfectly

but i want to use it through URL because as like images if we use them directly in jar they are worthless but if we use them through URL than it will work

same is here i am using the database directly and it is establishing connection work perfectly but when i make the jar there is exception

so taht i want to use it through URL
 
Ulf Dittmer
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It may be that that's what you want, but as I said, it's not going to happen. If you want to ship a DB file as part of your application's jar file, check out HSQLDB which can access a read-only DB in a jar file through JDBC.
 
Vivek Moyal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tell me if its working through first code than why it is not working from second code

ohk than tell me the way so that i can establish the connection to the ODBC services through the code
 
Ulf Dittmer
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tell me if its working through first code than why it is not working from second code


Logically, there's no reason why something that works through files should also work through the resource loading mechanism. And in this case, there is a very good reason why it would NOT work, namely that DBs are generally read/write resources, and write access is not possible for resources in jar files. That's rather different from images which are most often read, but not written.

ohk than tell me the way so that i can establish the connection to the ODBC services through the code


You need to ship the MDB file along with the jar file.
 
The airline is called "Virgin"? Don't you want a plane to go all the way? This tiny ad will go all the way:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic