Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Storing file in Microsoft Access using Java  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

have been requested by a friend to replace the interface of his application as at the moment he is making use of Access. In order not to go through a lot of hassle, I am going to use the same database and change the interface to Java. However an issue that I have encountered is the saving of file in Access database directly, something that is easily done in Microsoft Access itself.

Glad if someone may give me some hints/sources or ideas on how to handle this as I do not have any idea of what it entails to implement it.
 
Marshal
Posts: 61690
192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's duplicate this discussion in the databases forum.

Do you have to use Access? Does Access support COMMIT or UPDATE statements?
 
Terence Flores
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Campbell Ritchie,

have to use access as I do not wish to have to go through the issues of migrating the database. Would like to avoid that as well.

For all I know access supports COMMIT and UPDATE and from its use by my friend it seems so.
 
Rancher
Posts: 3743
40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What JDBC driver are you using for this?
That (might) affect what functionality you can use.

When you say "saving a file", do you mean as bytes rather than the text?
In otherwords, as a BLOB rather than a CLOB.
 
Terence Flores
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dace Tolls,

at this point I am at the research stage and since this is the first time I need to do this, I am investigating what possibilities exist as I do not want to waist a lot of time in finishing everything without resolving this problem.

For saving a file I mean storing the file in the access table similar to what one may do on Access since I need to integrate the application to the current db and provide also the current file viewing functionality.

Thanks.
 
Saloon Keeper
Posts: 5031
134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So by "file" you do not mean a file in the common sense, but rather all the data in the Access DB?

I find the approach strange, or maybe I'm not understanding correctly what you propose to do: you want to use Access as the DB, but not as the GUI, correct? That doesn't make sense to me: with Access, the GUI is the DB, more or less. If you don't want to use the GUI, there is no point in using Access as the DB, either. There is, however, the Jackcess library which has an API for Access files, if you wish to develop the GUI in Java (using the Swing or JavaFX APIs). or, if you have money to spend, there's the HXTT JDBC driver for Access.
 
Dave Tolls
Rancher
Posts: 3743
40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you'll need a driver (Tim has suggested a couple).
Looking at some Access docs and the column type for binary data would be BIGBINARY I think.

But I agree with Tim, why the need to do this?
 
Sheriff
Posts: 23866
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For those of you who are dubious about the idea of storing files in an Access database (as I was), have a look at this: Attach files and graphics to the records in your database.

So now I'm fairly certain that Terence means just what they say about saving a file in an Access database. I'm also fairly certain that JDBC doesn't have any features which remotely support getting those files back out of the Access database.

At least I was fairly certain until I tried the obvious Google search and came up with a question in another forum to which the answer was to use the UcanAccess JDBC database driver.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you say more about this ?,Campbell Ritchie
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!