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 Importing a SQLServer Schema using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Importing a SQLServer Schema using java" Watch "Importing a SQLServer Schema using java" New topic
Author

Importing a SQLServer Schema using java

Ronan Dowd
Ranch Hand

Joined: Jan 21, 2006
Posts: 84
Hi All,

Does Java have any support for importing a SQL Server database ?

I have a SQL Server database schema which I've backed up. So it's called something like "ms-schema.bak"

Basically my application needs to take in as input a database backup (i.e a bak file) and actually restore the database

Any help would be great on this..

Thanks, Ro.

SCJP 1.4 | OCWCD JEE 5
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18748
    
  40

Here is the JDBC driver for SQL server...

http://msdn.microsoft.com/en-us/data/aa937724.aspx

With this, you should be able to get to SQL server, with Java via JDBC. Now, how to do the restore and stuff, I guess that is a SQL server capability.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4180
    
  21

I did a little search, and it seems that there are SQL commands for restoring a database. See: this Google Search. What commands and how to use them depend on version of SQL Server, and where your files are stored.

Some of those search returns suggest there is a command line you can use to restore a DB, but I didn't read enough to know if it was custom written, builtin to the the SQL Server bin directory, or a third party product.


Steve
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19672
    
  18

Moving to JDBC


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Importing a SQLServer Schema using java