File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes restoring database using sql file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "restoring database using sql file" Watch "restoring database using sql file" New topic
Author

restoring database using sql file

Santhosh Puttu
Greenhorn

Joined: Jun 08, 2010
Posts: 27
Hi, I have a sql file.
I have formatted my system hence my earlier database is deleted.
I thought since I have sql file I can restore my database with all tables created.
Now, I am using following command to restore database.

But, it is displaying an error as:
Error 1064(42000): You have an error in your sql syntax



Do i need to give complete path.?
I tried that too but no use.

My sql file is on desktop.
How to restore the database using this sql file?



Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

The error is telling you that there is an error inside studentdb.sql

How did you make the database dump??

When I need to dump my database, I use this command:

and then back to mySQL


Regards, Rene Larsen
Dropbox Invite
ip sinha
Greenhorn

Joined: Jul 16, 2010
Posts: 1
Use the following command:

mysql studentdb< studentdb.sql -u root -p

it will ask for password, if you provide correct password you will be able to execute the command successfully.

scjp 88%
Santhosh Puttu
Greenhorn

Joined: Jun 08, 2010
Posts: 27
No.
I tried again same problem.

Do not know where am I going Wrong.
Actually, SQL file was created by my colleague and he has quit the job.

Any suggestions, In what other ways can I do it?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38007
    
  22
Welcome to the Ranch LP Sinha
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

You need to look inside the file studentdb.sql - and then find the SQL syntax error.
Santhosh Puttu
Greenhorn

Joined: Jun 08, 2010
Posts: 27
Thank you all.
I will try that.
So friendly.
I just love this place.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: restoring database using sql file
 
Similar Threads
Back Up & Restore Database
Runtime.exec()
Problems with creating table in mysql through JSP
HIbernate, hbm2ddl schema export: script error
mysql database restore