Solved

MSSQL Database backup with Java

Posted on 2003-11-28
12
767 Views
Last Modified: 2010-04-01
Hi,
 
 I have got an option in my web site to take backup of a MSSQL database. How could I do that?
 My idea is : I need to execute some .bat file from java with database name as parameter and the bat file should login into MSSQL server and create backup and copy into specified folder.

 Is there any other way yo do this by using only JAVA?

 Please help me..

thanks a lot..
eve of Chris!
lam
0
Comment
Question by:lamdor
  • 4
  • 3
  • 2
  • +1
12 Comments
 
LVL 14

Expert Comment

by:kennethxu
ID: 9841503
if you don't mind to start to close your old questions:
http://www.experts-exchange.com/Web/Web_Languages/JSP/QH_1072861.html
0
 
LVL 92

Expert Comment

by:objects
ID: 9841546
Using Runtime.exec() to run your batch sounds like the best solution.
0
 
LVL 1

Author Comment

by:lamdor
ID: 9854465
Hi kennethxu,
 

  I have not yet got expected answer from any experts thats why I have not closed..

 thanks,

regards
lam.
0
 

Expert Comment

by:davidnaude
ID: 9859996
Just to avoid confusion here, your looking for help on creating the bat file right?
0
 

Expert Comment

by:davidnaude
ID: 9860164
Why not just run the command "backup database <DBName>", try this in query analyser. You will have to have setup your database backup devices already.

Have a look at the following SQL Script

backup database EBO_Bourne_Leisure
      TO DISK = 'c:\DB1.BAK'
      WITH FORMAT,
      NAME = 'My DB Backup'

I have not tried this(quite sure it will work though), but if your not happy with running this directly in your Java App then you can always create a bat file and execute the isql command. To find out more about isql, go into the command propmt and type "isql -?"
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:lamdor
ID: 9955290
Hi,

 the problem is I am not using windows operating system for hosting the application. I am using Linux as webserver OS. In that I need to use pure java solution for the problem..can anybody tell me how can I?

thanks.
lsm
0
 
LVL 1

Author Comment

by:lamdor
ID: 10144181
Hi all,

 Here I am not asking to create a bat file which does database backup operation. I am looking for a Pure Java solution where I can connect to DB and issue commands (SQL) from Java application to create backup for the database. Is there any way to achive the same..

 Thanks a lot for all experts..

with lluv
dev.
0
 
LVL 14

Accepted Solution

by:
kennethxu earned 100 total points
ID: 10146561
>> I am looking for a Pure Java solution where I can connect to DB and issue commands (SQL) from Java application to create backup for the database.

Then, the answer to your question is NO, you cannot.
Unless the database vendor provided you with such an interface or they are willing to share you with the detail of their native protocol and you are prepared to implement the protocol in java yourself.
0
 
LVL 1

Author Comment

by:lamdor
ID: 10223646
Hi,


 I think this can be achieved with JNI. the databases provide us C Interface from which we can take backups/restores. In that came my program has to call C program..I think..I am under testing this...I will reply soon again..

Thanks for comments kennethxu,davidnaude, objects..

0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10237996
>> C Interface from which we can take backups/restores.
I know there is C interface for DML, but interms of backup/restore. I would be interested to learn if it is documented in anywhere by M$.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
spring AOP 6 71
stateless EJB with glassfish 2 70
build fail in maven project 11 172
IE doesn't Invoke servlet in iframe 1 94
What is Backup? Backup software creates one or more copies of the data on your digital devices in case your original data is lost or damaged. Different backup solutions protect different kinds of data and different combinations of devices. For e…
We have come a long way with backup and data protection — from backing up to floppies, external drives, CDs, Blu-ray, flash drives, SSD drives, and now to the cloud.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now