package com.test;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import oracle.sql.BLOB;
public class photoDAO {
public void savePic(int length, String bitmap_data) throws Exception{
byte[] bytes = new byte[length];
bytes = new sun.misc.BASE64Decoder().decodeBuffer(bitmap_data);
writeToFile(bytes);
insert(bytes);
}
private void writeToFile(byte[] buffer) throws IOException {
File myFile = new File("C://1.jpg");
FileOutputStream fos = new FileOutputStream(myFile);
fos.write(buffer);
}
public void insert(byte[] buffer)throws Exception
{
int id=1;
String sql;
Connection conn=getConnection();
conn.setAutoCommit(false);
sql="delete from a where iid=?";
PreparedStatement ps=conn.prepareStatement(sql);
ps.setInt(1, id);
ps.execute();
conn.commit();
sql="insert into a(iid,photo) values(?,empty_blob())";
PreparedStatement ps1=conn.prepareStatement(sql);
ps1.setInt(1, id);
ps1.executeUpdate();
sql="select * from a where iid=? for update";
ps1.setInt(1, id);
ResultSet rs=ps1.executeQuery(sql);
if(rs.next())
{
BLOB blob=(BLOB) rs.getBlob("photo");
blob.putBytes(1,buffer);
ps.close();
ps1.close();
conn.commit();
}
try
{
conn.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static Connection getConnection()throws Exception
{
//DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//使用OCI8连接到数据库
//Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:dragon","dragon","123456");
//conn.setAutoCommit(true);
//return conn;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String url="jdbc:oracle:thin:@localhost:1521:dragon";
String user="dragon";
String password="123456";
Connection conn= DriverManager.getConnection(url,user,password);
return conn;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
JSP 网上在线拍照源码
共50个文件
jar:12个
xml:6个
html:5个
4星 · 超过85%的资源 需积分: 12 242 下载量 78 浏览量
2008-09-15
16:51:35
上传
评论
收藏 4.96MB RAR 举报
温馨提示
利用FLEX插件实现JSP网上拍照,在使用前要先安装Flex插件,官网上有下载,不够要注册用户才行。
资源推荐
资源详情
资源评论
收起资源包目录
FlexPic.rar (50个子文件)
FlexPic
.project 2KB
flex_libs
bin
.settings
org.eclipse.core.resources.prefs 88B
org.eclipse.wst.common.component 516B
org.eclipse.jdt.core.prefs 330B
org.eclipse.wst.common.project.facet.core.xml 269B
org.eclipse.jst.common.project.facet.core.prefs 288B
.mymetadata 294B
WebRoot
WEB-INF
flex
messaging-config.xml 513B
remoting-config.xml 555B
services-config.xml 4KB
proxy-config.xml 826B
web.xml 2KB
src
lib
commons-logging.jar 37KB
backport-util-concurrent.jar 319KB
cfgatewayadapter.jar 15KB
flex-messaging-proxy.jar 64KB
commons-httpclient-3.0.1.jar 273KB
flex-messaging-remoting.jar 18KB
commons-codec-1.3.jar 46KB
concurrent.jar 168KB
flex-messaging-common.jar 92KB
flex-messaging-core.jar 599KB
flex-messaging-opt.jar 20KB
xalan.jar 3MB
classes
com
test
photoDAO.class 3KB
bin
AC_OETags.js 8KB
FlexPic.swf 405KB
FlexPic.html 4KB
history
history.js 24KB
historyFrame.html 807B
history.css 371B
playerProductInstall.swf 657B
time.html 4KB
time.swf 358KB
META-INF
MANIFEST.MF 252B
images
1.jpg 4KB
Thumbs.db 5KB
.actionScriptProperties 973B
html-template
AC_OETags.js 8KB
index.template.html 4KB
history
history.js 24KB
historyFrame.html 807B
history.css 371B
playerProductInstall.swf 657B
.myeclipse
src
com
test
photoDAO.java 2KB
.classpath 594B
flex_src
FlexPic.mxml 8KB
Base64.as 5KB
BitmapBytes.as 2KB
.flexProperties 336B
共 50 条
- 1
万里无疆
- 粉丝: 6
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页