
可以使用FTP登录到虚拟主机的磁盘上然后下载
当然啦,在此前,你要知道,你的文件是备份到了什么位置
(备注:通常会起一个文件夹名为BAK的,然后在里面存放备份文件)
/
Created by IntelliJ IDEA
User: ljt
Date: 2003-3-31
Time: 18:51:38
To change this template use Options | File Templates
/
import oraclejdbcdriverOraclePreparedStatement;
import oraclejdbcdriverOracleResultSet;
import javasqlConnection;
import javasqlDriverManager;
import javasqlStatement;
import javasqlClob;
public class TestOpenDoc {
public OracleResultSet ors = null; //这里rs一定要用Oracle提供的
public OraclePreparedStatement opst = null; //PreparedStatement用
public Connection conn = null;
public Statement stmt = null;
public TestOpenDoc() {
}
public boolean getConnect() {
//这是我的数据库所在
String serverName = "prosrv";
try {
ClassforName("oraclejdbcdriverOracleDriver");
String url = "jdbc:oracle:thin:@" + serverName + ":1521:BOHDATA";
conn = DriverManagergetConnection(url, "appuser", "appuser");
}
catch (Exception e) {
Systemoutprintln(e);
return false;
}
return true;
}
public static void main(String[] args) {
TestOpenDoc test = new TestOpenDoc();
if (!testgetConnect()) {
Systemoutprintln("数据库连结错误");
return ;
}
try{
testconnsetAutoCommit(false);
byte a[] = null; //将测试文件testdoc读入此字节数组
javaioFileInputStream fin = null;
javaioFileOutputStream fout = null;
//Oracle提供的
try {
javaioFile f1 = new javaioFile("c:/testdoc");
javaioFile f2 = new javaioFile("d:/testoutdoc"); //从BLOB读出的信息写
//入该文 件,和源文件对比测试用
fin = new javaioFileInputStream(f1);
fout = new javaioFileOutputStream(f2);
int flength = (int) f1length(); //读入文件的字节长度
Systemoutprintln("file length::" + flength);
a = new byte[flength];
int i = 0;
int itotal = 0;
// 将文件读入字节数组
for (; itotal < flength; itotal = i + itotal) {
i = finread(a, itotal, flength - itotal);
}
finclose();
Systemoutprintln("read itotal::" + itotal);
//注意Oracle的 BLOB一定要用EMPTY_BLOB()初始化
String mysql =
"insert into filelist (FileName,FileSize,FileBody) values (,,EMPTY_BLOB())";
OraclePreparedStatement opst = (OraclePreparedStatement) testconn
prepareStatement(mysql);
opstsetString(1, "wordtemplate2");
opstsetInt(2, flength);
opstexecuteUpdate();
opstclearParameters();
// /插入其它数据后,定位BLOB字段
mysql = "select filebody from filelist where filename=";
opst = (OraclePreparedStatement) testconnprepareStatement(mysql);
opstsetString(1, "wordtemplate2");
OracleResultSet ors = (OracleResultSet) opstexecuteQuery();
if (orsnext()) {
oraclesqlBLOB blob = orsgetBLOB(1); //得到BLOB字段
int j = blobputBytes(1, a); //将字节数组写入BLOB字段
Systemoutprintln("j:" + j);
testconncommit();
orsclose();
Clob clob;
clob = orsgetClob("");
String str;
str = clobtoString();
str = clobgetSubString(0L,(int)cloblength());
Systemoutprintln(str);
}
Systemoutprintln("insert into ok");
byte b[] = null; //保存从BLOB读出的字节
opstclearParameters();
mysql = "select filebody from filelist where filename=";
opst = (OraclePreparedStatement) testconn
prepareStatement(mysql);
opstsetString(1, "wordtemplate2");
ors = (OracleResultSet) opstexecuteQuery();
if (orsnext()) {
oraclesqlBLOB blob2 = orsgetBLOB(1);
Systemoutprintln("blob2 length:" + blob2length());
b = blob2getBytes(1, flength); //从BLOB取出字节流数据
Systemoutprintln("b length::" + blength);
testconncommit();
}
orsclose();
// 将从BLOB读出的字节写入文件
foutwrite(b, 0, blength);
foutclose();
Systemoutprintln("write itotal::" + blength);
}
catch (Exception e) {
Systemoutprintln("errror :" + etoString());
eprintStackTrace();
}
finally { //关闭所有数据联接
testconncommit();
}
}
catch(Exception e){
Systemoutprintln(e);
}
}
}
以上就是关于ms sql数据库备份如何下载全部的内容,包括:ms sql数据库备份如何下载、java如何从数据库中下载以二进制存储的图片、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)