I am developing e-library for visually challenged people, in this system i kept a utility to add book from one interface. I want to store the location of the actual book in the database while adding a book.
For e.x.
I am storing the book at c:\books\pdfbooks\bookname.pdf

this location c:\books\pdfbooks\bookname.pdf
I want to store in the database automatically through coding at the background.

Can anyone help???????
Thanx in advance.........

As you forgot to shed some light into file selection process, I can only recommend you to have look and consider use of File method getAbsolutePath() that will return String representation of file location

I am planning to use Desktop.getDesktop().Copy() or Move() method to save the file. So, how to store that location automatically.

Where are you getting these methods from? Neither I, nor the API documentation, knows anything about them.

Off topic - I guess somebody nailed your a$$ masijade :D , or somebody uses same name on Sun forum (highly unlikely)

So now what shall i do. I need the solution. Can u please help me?

I am developing the application where I need to open the book in text format word format, and say pdf format. What to do? I have to solve the problems on getting the location of the file too.

Please help

Off topic - I guess somebody nailed your a$$ masijade :D , or somebody uses same name on Sun forum (highly unlikely)

No. It's my nick, and DeskTop, and getDeskTop are valid, it's "Copy" and "Move" that don't exist. ;)

then what shall I do to add the book into the database of my library. Can u suggest anything?
Please help

Without mentioning any classes, describe exactly what it is you want to do again, because the first post, to me, doesn't make much sense.

Where is the "file" coming from?
Why do you need to "copy" it?
And, if you are copying it, why don't you know where you are copying it?

M developing e-library. Where one interface is provided by me for the users to add books into the database. Here, I want to add the books. Ofcourse, one more utility to open the desired book in desired format say .pdf. In my database I am storing the location of the book where they are stored and picking up that location to pass as a parameter to File class and using Desktop.getDesktop().open(File fl) to open the book.(Its working too).I can store the location of the available books directly into the database table. But this would be fine for the available books only. What if someone wants to add the book later on. Thats why i kept utility to add the books to the database through interface.

Questions are======>

1) How to add the books into the database the database is supposed to be on the remote server?

2) Since the user will adding the books how can he add the books and also storing their location to the database from interface.

Hope you got my point.
If you still confused can u please give me your gmail-id we can chat as i am online and hope u r online too
Please help me in any manner I am struggling with this problem from too long.

Thanks

Aren't "adding the books" to the database and "storing the books to the database" the same exact thing? You said them as if they were different. And we don't do chats and stuff like that, keep it on the site.

I still don't understand exactly what you want.

If this is a web application, then the "File" and "DeskTop" classes don't come into play (if you mean an application used through a browser), and so I don't know what you're getting at.

If it is not a web application, but rather a "distributed" application, then you would insert books using the same connection as you do to query them. In this case, see Sun's JDBC Tutorial.

First of all, my application is not web based. It is distributed application.
Continuing problem statement....
As in yahoo(just giving example) when we have to attach a file we are clicking on Browse button, and selecting the file to be attached. Ultimately. the location of the file is coming in the textfield. In this way I too want to read the location of the while where I have stored it. I want my system to read the location automaitcally, but for storing that location.
Suppose somebody is storing the book at

d:/ebooks/book.pdf

So this location should be stored in the database automatically.

Now if someone is storing the book at

e:/books/linux.pdf

So this too get stored properly in the location automatically.

I just want to store the locaiton however it is. My aim is to make my application as dyanmic as possible. I think writing too much is making others confused.

Can anybody help! Otherwise some R&D has to be performed by me.
Please help

Note: Please dont send me insert statement I know them very well.

If it is a "distributed" app, I assume you have a GUI. Look at the JFileChooser class.

I have seen the JFIleChooser utility. It is really usefull thanx for your valueable help. But I am unable to save the file. On clicking the save button it is not saving the file at the requested button.
One more thing
What is the difference between JFileChooser.APPROVE_SELECTION and JFileChooser.approveSelection()?
I have gone through the Javatutorial for the same but still did not understand?

Thanking You

APPROVE_SELECTION is a constant, which cannot do anything on its own. It is simply a variable that has a value. approveSelection() is a method, and methods can "do things". For example APPROVE_SELECTION might be a value indicating whether or not to OK what the user has selected. But the method approveSelection() will go ahead and do something to approve the selection. In other words variables (APPROVE_SELECTION) store values, methods (approveSelection()) do things. I hope that makes sense.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.