Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to display the binary Database file In Jtable (Show All data as per column)  RSS feed

 
sudip chavan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Database File (VinylAlbums.db)

================================================================================
MODERATOR ACTION: I have removed code tags from the following, as it was making the page unusably wide.
If you wish to convey this information in a formatted manner, please trim it down so it fits in one screen width.
================================================================================
m y Led Zeppelin Atlantic Records 26 Communication breakdown, Babe I'm gonna leave you, Good times bad times Digital remastered compilation. The Colour of Spring Talk Talk EMI Records 8 Happiness is easy, I don't believe in you, Life's what you make it Definitive album from understated eighties band. Play Moby Mute Records Limited 18 Honey, Find my baby, Porcelain Mult-award winning masterpiece from small bald chap. White Ladder David Gray Chrysalis Music Limited 10 Babylon, White Ladder, Sail Away Tending towards the middle of the road. Three feet high and rising De La Soul Tommy Boy Music Inc. 24 The magic number, Say no go, Me myself and I I really was listening to hip hop before you were born! Scarlet and other stories All About Eve 1989 Phonogram Limited 13 Scarlet, December, Tuesday's Child A hippy rock fusion from the mid-eighties The Bends Radiohead Parlophone 12 The Bends, Just, Black Star Award winning album, all downhill from here on. Powerage AC/DC EMI Records 9 Riff Raff, Sin City, Gone shootin Some classic tracks on this often overlooked album. Asleep in the back Elbow V2 Music Limited 11 Newborn, Coming Second, Can't Stop Much anticipated debut album, received award nominations. Blood, Sugar, Sex, Magic Red Hot Chilli Peppers Warner Bros Records Inc.
=============================== END MODERATOR ACTION =================================================

Database schema
 
sudip chavan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help me guy's I'm really worried
 
Rob Spoor
Sheriff
Posts: 21092
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PatienceIsAVirtue.
 
sudip chavan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help me guy's !!
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As already mentioned, PatienceIsAVirtue.(⇐click)

So is actually asking a question. You need to TellTheDetails(⇐click) of what exactly you're trying to do and what exactly you're having trouble with.
 
sudip chavan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hii Jeff ..I don't want any changes in database ..but I would like to do the change In table query as per database schema which I given you I need to using input/outputStream for that table to database connectivity ..

thanks your reply Jeff !
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sudip chavan wrote:Hii Jeff ..I don't want any changes in database ..but I would like to do the change In table query as per database schema which I given you I need to using input/outputStream for that table to database connectivity ..


I still have no idea what you're trying to do or what problems you're having doing it.
 
sudip chavan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff i want show that database to my JTable ..as per column and row ..and problem is that ..that database is binary database ..we have to connect that database using Input/OutputStream reader/writer ..I was tried to do that ..but something is write wrong in JTable ..so I'm not able to connect to database ..
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sudip chavan wrote:Jeff i want show that database to my JTable ..as per column and row ..and problem is that ..that database is binary database ..we have to connect that database using Input/OutputStream reader/writer ..I was tried to do that ..but something is write wrong in JTable ..so I'm not able to connect to database ..



So you have two parts to your problem.

1) Retrieving data from the DB.

2) Dsplaying data in the JTable.

Note that #1 and #2 are completely independent and have nothing to do with each other. If you can't connect to the DB, that has nothing to do with the JTable.

So you are able to do #2, yes? You can take some hardcoded data and display it the way you want? So the only problem now is #1?

Assuming I understand correctly...

I have no idea what this "binary database" is. If it is actually a database, then you'll need to use JDBC and the appropriate driver to query it. If it's just a file, then you'll need to find out what the format of that file is, and either write code to parse it or find a third party library that does so. And don't say it's "binary format" or "binary database format". Those terms don't mean anything specific enough to use.
 
sudip chavan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah correct i have 2 problems .. But there is using JDBC for sql database ..But, here we using I/O reading and writing database binary format file ..
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sudip chavan wrote:Yeah correct i have 2 problems .. But there is using JDBC for sql database ..But, here we using I/O reading and writing database binary format file ..


And as I already pointed out, "database binary format" means nothing. It's like saying "picture binary format." That could mean JPEG, GIF, TIFF, or dozens of others.

So, as I also already pointed out, you need to do some research on what that format actually is, and if there's a 3rd party library out there you can use to read it.

Some suggestions toward that goal:

1. Ask the person who created the file.

2. Check the docs or tools that came with the app that created the file.

3. Do a web search for something like java XYZ file API, where "XYZ" is the name of the app that created the file.
 
sudip chavan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See this info ..which they provide us about database

The database
The data file is a binary data file. The structure of the provided database file must not be altered.
This means that any other data format, such as text files, SQL/JDBC, XML or serialised objects are not permissible.
Please note that when the work is assessed, the marker will use a copy of the original file to check that its structure has not been altered.
Failure to adhere to the above instructions will result in an automatic failure.
The format of the data in the database file is as follows:-
Start of file
4 byte numeric, magic cookie value
Data section Repeat to end of file: 1 byte flag. 0x00 implies valid record - 0xFF implies deleted record Record containing fields in order specified in schema section, no separators between fields, each field fixed length at maximum specified in schema information
End of file
The data schema is as follows:-

Database field Field length (bytes)
Album title 64
Artist name 32
Production company name 32
Total number of track on album 8
A sample of three tracks on the album 128
General description 128
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so it's a proprietary format binary file with data in it. It's not a "database" in the normal sense of the word so stop calling it that. It just confuses the issue.

If the provider of this file doesn't have an API to access the data within (how lame if that's the case) you'll need to write your own API to do so given the information as to its format.
 
sudip chavan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah ..It's binary format file ..So my is vector not able to show the data ..
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As has been already pointed out by both of us, you can't display the data until you can get the data. What are your plans for that? Until you can get the data, any talk of doing anything at all with it is a waste.
 
sudip chavan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is need to write RandomAccessfile query to get access from binary file.

VinylAlbums.db

================================================================================
MODERATOR ACTION: I have removed code tags from the following, again as it was making the page unusably wide.
So, once again, if you wish to convey this information in a formatted manner, please trim it down so it fits in one screen width.
================================================================================
c Remasters Led Zeppelin Atlantic Records 26 Communication breakdown, Babe I'm gonna leave you, Good times bad times Digital remastered compilation. The Colour of Spring Talk Talk EMI Records 8 Happiness is easy, I don't believe in you, Life's what you make it Definitive album from understated eighties band. Play Moby Mute Records Limited 18 Honey, Find my baby, Porcelain Mult-award winning masterpiece from small bald chap. White Ladder David Gray Chrysalis Music Limited 10 Babylon, White Ladder, Sail Away Tending towards the middle of the road. Three feet high and rising De La Soul Tommy Boy Music Inc. 24 The magic number, Say no go, Me myself and I I really was listening to hip hop before you were born! Scarlet and other stories All About Eve 1989 Phonogram Limited 13 Scarlet, December, Tuesday's Child A hippy rock fusion from the mid-eighties The Bends Radiohead Parlophone 12 The Bends, Just, Black Star Award winning album, all downhill from here on. Powerage AC/DC EMI Records 9 Riff Raff, Sin City, Gone shootin Some classic tracks on this often overlooked album. Asleep in the back Elbow V2 Music Limited 11 Newborn, Coming Second, Can't Stop Much anticipated debut album, received award nominations. Blood, Sugar, Sex, Magic Red Hot Chilli Peppers Warner Bros Records Inc. 17 Under the bridge, Funky Monks, Give it away Contains language that some people may find offensive. Hits Pulp Universal Island Records Limited17 Common People, Disco 2000, Sunrise A compilation of greatest hits. Surrender Chemical Brothers Virgin Records Limited 11 Let forever be, hey boy hey girl, surrender Dance rock fusion with numerous guest artists. Best of Bowie David Bowie EMI Records 20 Space Oddity, Starman, China Girl Every track a hit on this definitive compilation. Singles The Smiths Warner Bros Records Inc. 18 Hand in glove, This charming man, Panic Compilation of singles from the ground-breaking indie band. The hour of the bewilderbeast Badly drawn boy XL Recordings 18 The shining, This song, Say it again Mercury prize winning album. Greatest Hits Bob Dylan Sony Music Entertainment Inc. 10 Blowin in the wind, Like a rolling stone, Mr tamborine man Classic Dylan. Edward The Great, Greatest Hits Iron Maiden EMI Records 16 Run to the hills, The Trouper, 2 Minutes to midnight Compilation of studio and live tracks. Lisa Lisa Stansfield BMG Records 13 Real love, All woman, Tenderly One for the ladies. Back in Black AC/DC Atlantic Records 10 Hell's Bells, Back in Black, Have a drink on me Definitive heavy metal album, ranked in the top 5 ever. Singles The Clash Sony Music Entertainment Inc. 18 Tommy Gun, I fought the law, Rock the casbah Compilation of singles from definitive post-punk band.
================================================================================
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sudip chavan wrote:Yeah ..It's binary format file ..So my is vector not able to show the data ..


Your instructor has told you what the format is, so you need to read the bytes according to the rules he described and create the appropriate Java types from the data you read. I hope it's obvious to you that one of the first things you should do is define a class with the fields he mentions. Then, if you don't know how to read the fields from the file, you'll need to study the relevant sections of your textbook, and/or google for, say, java io tutorial
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sudip chavan wrote:There is need to write RandomAccessfile query to get access from binary file.


You've already said that. Repeating it doesn't add more information.
 
sudip chavan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know there is two way to read/write binary format file ..But I'm not able to write query as per the JTable
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sudip chavan wrote:I know there is two way to read/write binary format file


There are more ways than two, but I don't see how that's relevant anyway.

..But I'm not able to write query as per the JTable


JTable has nothing to do with it. You need to separate these two processes. On the one hand, you have your JTable. It doesn't know and doesn't care where the data came from. So one task that you have is to get your JTable to display the information you give it in the format you want.

Therefore, without even thinking about the file, you need to hardcode some data and tell your JTable to display it. That data needs to be in the same structure that you'll put the data from the file in, but you can test it without the file.

Totally separately from that step--either before it or after it--you need to figure out how to read the data from the file and put it into the class you're going to define that represents one record from the so-called "binary database".

You test each part completely without regard to the existence of the other part. You can get the file reading working without the JTable, and you can get the JTable working without the file. Then, when they both work separately, you bring them together.
 
sudip chavan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code I have write ..for showing data in JTable but then also it's not working, can you help me, how to Vector have to work for this code
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sudip chavan wrote:This code I have write ..for showing data in JTable but then also it's not working,


ItDoesntWorkIsUseless.(⇐click)
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff Verdegan wrote:
sudip chavan wrote:This code I have write ..for showing data in JTable but then also it's not working,


ItDoesntWorkIsUseless.(⇐click)


Also, you're doing the exact opposite of the advice I gave. You have both the file reading code and the JTable display code there together. If you didn't test them separately first, you won't know which side the problem lies on.
 
sudip chavan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alright ..I have no word to ask anything .. thanks
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sudip chavan wrote:Alright ..I have no word to ask anything .. thanks


So, you are unable to describe in what way it's not working? You're unable to test the file reading and the JTable display separately? I'm sorry to hear that. Good luck.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!