这个视频上面的音乐频谱显示软件是用什么软件搞成的?

2559人阅读
Java web(6)
存入数据库
Connection conn =
&&ResultSet rs =
&&Statement stmt =&&
&&DBConnectionManager connMgr =
&&&String insertsql = &insert into image (id,pic) values(18,empty_blob())&;//首先插入一个空的Blob类型
&&&String updateSql=&select fujiannr from T_ZT_MYZJ_MYCJ where id=18 for update&;&&&&&&&&&&&
&&&connMgr = DBConnectionManager.getInstance();
&&&conn = connMgr.getConnection();
&&&conn.setAutoCommit(false);
&&&OutputStream os =&&
&&&stmt=conn.createStatement();
&&&stmt.executeUpdate(insertsql);
&&&rs=stmt.executeQuery(updateSql);
&&&if (rs.next())
&&&&oracle.sql.BLOB blob = (oracle.sql.BLOB) rs.getBlob(&fujiannr&);&&
&&&& os = blob.getBinaryOutputStream();&&
&&&& InputStream is1= new FileInputStream(&c:\\1.png&);&&
&&&& int i = 0;&
&&&& while ((i = is1.read()) != -1) {&&
&&&&& os.write(i);&&
&&& os.flush();
&&&&&& os.close();
&&catch (Exception e)
&&&e.printStackTrace();
&&finally {
&&&closeAll(rs, stmt,conn);
//失放资源
&&ClassLoader cl = this.getClass().getClassLoader();
&&InputStream pro = cl.getResourceAsStream(&&);
&&Properties dbProps = new Properties();
&&&dbProps.load(pro);
&&} catch (Exception e) {
&&String driverClasses = dbProps.getProperty(&dbDriver&);
&&connMgr.freeConnection(driverClasses, conn);
从数据库中读取图片
&&Connection conn =
&&ResultSet rs =
&&Statement stmt =&&
&&InputStream issgg =
&&DBConnectionManager connMgr =
&&byte bs[] =
&&{&&&&&&&&&&
&&&connMgr = DBConnectionManager.getInstance();
&&&conn = connMgr.getConnection();
&&&conn.setAutoCommit(false);
&&&stmt=conn.createStatement();
&&&String str = &select&pic from&image where id=18&;&
&&&rs=stmt.executeQuery(str);
&&&rs.next();
&&&Blob ob =
&&&ob=rs.getBlob(1);
&&&long size = ob.length();
&&&bs = ob.getBytes(1, (int)size);&&
&& File file = new File(&c:\\& + &image.png&);
&&&&&&&& if (!file.exists())
&&&&&&&& {
&&&&&&&&&&&& file.createNewFile(); // 如果文件不存在,则创建
&&&&&&&& }
&&&&&&&& FileOutputStream fos = new FileOutputStream(file);&
&&&&&&&& if (data.length & 0)
&&&&&&&& {
&&&&&&&&&&&& fos.write(bs, 0, bs.length);
&&&&&&&& }
&&&&&&&& else
&&&&&&&& {
&&&&&&&&&&&& //while ((size = in.read(bs)) != -1)
&&&&&&&&&&&&// {
&&&&&&&&&&&&&&&///& fos.write(bs, 0, size);
&&&&&&&&&&&&// }
&&&&&&&&&&&&// in.close();
&&&&&&&& }
&&&&&&&& fos.close();
&&catch (Exception e)
&&&e.printStackTrace();
&&finally {
&&&closeAll(rs, stmt,conn);
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:196334次
积分:2746
积分:2746
排名:第10675名
原创:63篇
转载:158篇
(2)(1)(1)(5)(11)(6)(2)(12)(19)(8)(3)(3)(2)(17)(1)(1)(2)(4)(3)(2)(6)(1)(6)(1)(2)(1)(2)(2)(1)(3)(7)(4)(1)(3)(1)(1)(2)(4)(6)(2)(1)(1)(1)(1)(1)(1)(2)(3)(1)(6)(10)(1)(2)(5)(9)(20)(3)java实现将xml数据插入到oracle数据库的表中
package xml2
import java.sql.C
import java.sql.DriverM
import java.sql.PreparedS
import java.sql.SQLE
public class DbUtil {
* 功能:编写一个静态方法用于与建立连接 输入参数:无 返回值:数据库连接对象
public static Connection getConnection() {
// 定义一个连接对象
Connection conn =
// 定义连接数据库的URL资源
String url = &jdbc:oracle:thin:@10.20.56.52:1521:orcl&;
// 定义连接数据库的用户名称与密码
String username = &crm&;
String password = &crm&;
// 加载数据库连接驱动
String className = &oracle.jdbc.driver.Driver&;
Class.forName(className);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
// 获取数据库的连接对象
conn = DriverManager.getConnection(url, username, password);
System.out.println(&数据库连接建立成功...&);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
// 返回连接对象
public static
void close(Connection c)
if(c!=null)
c.close();
} catch (Throwable e) {
e.printStackTrace();
public static
void close(PreparedStatement c)
if(c!=null)
c.close();
} catch (Throwable e) {
e.printStackTrace();
2、xml2table
package xml2
import java.io.F
import java.sql.C
import java.sql.PreparedS
import java.util.I
import java.util.L
import org.dom4j.D
import org.dom4j.DocumentE
import org.dom4j.DocumentH
import org.dom4j.E
import org.dom4j.N
import org.dom4j.io.SAXR
public class xml2table {
public static void main(String[] args){
//插入数据的sql语句
String sql=&insert into bank_insurance(flag,descrip,ContNo,ProposalPrtNo,Prem,PremText,Amnt,AmntText,AgentCode,AgentCertNo,AgentName,AgentGrpCode,AgentGrpName,AgentCom,AgentComName,ComCode,ComLocation,ComName,ComZipCode,ComPhone,ValidDate,
// ExpireDate,
// PolicyValue,
// AutoTransferAccNo,
// AppntGetAccNo,
// AppntProv,
// AppntCity,
// AppntCounty,
// AppntNativeplace,
// AppntAddress,
// AppntCustomerNo,
// AppntName,
// AppntSex,
// AppntBirthday,
// AppntIDType,
// AppntIDNo,
// AppntIdEfDate,
// AppntIdExpDate,
// AppntJobType,
// AppntJobCode,
// AppntJobName,
// AppntNationality,
// AppntStature,
// AppntWeight,
// AppntMaritalStatus,
// AppntZipCode,
// AppntMobile,
// AppntPhone,
// AppntEmail,
// AppntRelaToInsured,
// AppntEstSalary,
// AppntFamilyEstSalary,
// AppntLiveZone,
// InsuredGetAccNo,
// InsuredProv,
// InsuredCity,
// InsuredCounty,
// InsuredNativeplace,
// InsuredAddress,
// InsuredName,
// InsuredSex,
// InsuredBirthday,
// InsuredIDType,
// InsuredIDNo,
// InsuredJobType,
// InsuredJobCode,
// InsuredJobName,
// InsuredStature,
// InsuredNationality,
// InsuredWeight,
// InsuredMaritalStatus,
// InsuredZipCode,
// InsuredMobile,
// InsuredPhone,
// InsuredEmail,
// InsuredEsSalary,
// Bnf1Type,
// Bnf1Grade,
// Bnf1Name,
// Bnf1Birthday,
// Bnf1Sex,
// Bnf1IDType,
// Bnf1IDNo,
// Bnf1RelaToInsured,
// Bnf1Lot,
// Bnf2Type,
// Bnf2Grade,
// Bnf2Name,
// Bnf2Birthday,
// Bnf2Sex,
// Bnf2IDType,
// Bnf2IDNo,
// Bnf2RelaToInsured,
// Bnf2Lot,
// RiskCode1,
// RiskName1,
// MainRiskCode1,
// PolApplyDate1,
// SignDate1,
// CValiDate1,
// InsuEndDate1,
// PayIntv1,
// PayMode1,
// InsuYearFlag1,
// InsuYear1,
// InsuYearFlagA1,
// InsuYearA1,
// Years1,
// PayEndYearFlag1,
// PayEndYear1,
// PayEndDate1,
// CostIntv1,
// CostDate1,
// PayToDate1,
// GetYearFlag1,
// GetStartDate1,
// GetYear1,
// GetIntv1,
// GetBaCode1,
// GetBankAccNo1,
// GetAccName1,
// AutoPayFlag1,
// BonusGetMode1,
// SubFlag1,
// FullBonusGetMode1,
// Account1,
// EndYear0,
// EndYear1,
// EndYear2,
// EndYear3,
// EndYear4,
// EndYear5,
// EndYear6,
// EndYear7,
// EndYear8,
// EndYear9,
// EndYear10,
// Cash10,
// BonusValues1 ,
// SpecContent1,
// RiskCode2,
// RiskName2,
// MainRiskCode2,
// PolApplyDate2,
// SignDate2,
// CValiDate2,
// InsuEndDate2,
// PayIntv2,
// PayMode2,
// InsuYearFlag2,
// InsuYear2,
// InsuYearFlagA2,
// InsuYearA2,
// Years2,
// PayEndYearFlag2,
// PayEndYear2,
// PayEndDate2,
// CostIntv2,
// CostDate2,
// PayToDate2,
// GetYearFlag2,
// GetStartDate2,
// GetYear2,
// GetIntv2,
// GetBankCode2,
// GetBankAccNo2,
// GetAccName2,
// AutoPayFlag2,
// BonusGetMode2,
// SubFlag2,
// FullBonusGetMode2,
// Account2,
// BonusValues2,
// SpecContent2) values (?,?,?,
?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)&;
String sql=&insert into test1(flag, descrip, ContNo, ProposalPrtNo) values (?, ?, ?, ?)&;
String sql=&insert into test01(flag, descrip)&
+&values (?,?)&;
String sql=&insert into test02(flag, descrip,ContNo,ProposalPrtNo,Prem,PremText,Amnt,AmntText,AgentCode,AgentCertNo,AgentName,AgentGrpCode,AgentGrpName,AgentCom,AgentComName,ComCode,ComLocation,ComName,ComZipCode,ComPhone,ContState,ValidDate,ExpireDate,PolicyValue,AutoTransferAccNo)&
+&values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)&;
Connection conn=
PreparedStatement pstmt=
conn=DbUtil.getConnection();
pstmt=conn.prepareStatement(sql);
//读取xml文件
Document doc=new SAXReader().read(new File(&E:/xml2table/source.XML&));
//选择xml文件的节点
List itemList=doc.selectNodes(&TranData/Head&);
List itemList1=doc.selectNodes(&TranData/Body&);
//遍历读出的xml中的节点
for(Iterator iter=itemList.iterator();iter.hasNext();){
Element el=(Element)itemList.iterator().next();
Element el1=(Element)itemList1.iterator().next();
//读取节点内容
String Flag=el.elementText(&Flag&);
String Desc= el.elementText(&Desc&);
String ContNo = el1.elementText(&ContNo&);
String ProposalPrtNo = el1.elementText(&ProposalPrtNo&);
String Prem = el1.elementText(&Prem&);
String PremText = el1.elementText(&PremText&);
String Amnt = el1.elementText(&Amnt&);
String AmntText = el1.elementText(&AmntText&);
String AgentCode = el1.elementText(&AgentCode&);
String AgentCertNo = el1.elementText(&AgentCertNo&);
String AgentName = el1.elementText(&AgentName&);
String AgentGrpCode = el1.elementText(&AgentGrpCode&);
String AgentGrpName = el1.elementText(&AgentGrpName&);
String AgentCom = el1.elementText(&AgentCom&);
String AgentComName = el1.elementText(&AgentComName&);
String ComCode = el1.elementText(&ComCode&);
String ComLocation = el1.elementText(&ComLocation&);
String ComName = el1.elementText(&ComName&);
String ComZipCode = el1.elementText(&ComZipCode&);
String ComPhone = el1.elementText(&ComPhone&);
String ContState = el1.elementText(&ContState&);
String ValidDate = el1.elementText(&ValidDate&);
String ExpireDate = el1.elementText(&ExpireDate&);
String PolicyValue = el1.elementText(&PolicyValue&);
String AutoTransferAccNo = el1.elementText(&AutoTransferAccNo&);
//String nombre = el.elementText(&NOMBRE&);
//遍历TURNOS节点中的内容
List turnosList = el.elements(&TURNOS&);
StringBuffer sbString=new StringBuffer();
for(Iterator iter1=turnosList.iterator();iter1.hasNext();){
Element turnosElt=(Element)iter1.next();
String lu = turnosElt.elementText(&LU&);
String ma = turnosElt.elementText(&MA&);
String mi = turnosElt.elementText(&MI&);
String ju = turnosElt.elementText(&JU&);
String vi = turnosElt.elementText(&VI&);
String sa = turnosElt.elementText(&SA&);
String doo = turnosElt.elementText(&DO&);
sbString.append(lu + &,& + ma + &,& + mi + &,& + ju + &,& + vi + &,& + sa + &,& + doo);
//为sql语句赋值
pstmt.setString(1, Flag);
pstmt.setString(2, Desc);
pstmt.setString(3, ContNo);
pstmt.setString(4, ProposalPrtNo);
pstmt.setString(5, Prem);
pstmt.setString(6, PremText);
pstmt.setString(7, Amnt);
pstmt.setString(8, AmntText);
pstmt.setString(9, AgentCode);
pstmt.setString(10, AgentCertNo);
pstmt.setString(11, AgentName);
pstmt.setString(12, AgentGrpCode);
pstmt.setString(13, AgentGrpName);
pstmt.setString(14, AgentCom);
pstmt.setString(15, AgentComName);
pstmt.setString(16, ComCode);
pstmt.setString(17, ComLocation);
pstmt.setString(18, ComName);
pstmt.setString(19, ComZipCode);
pstmt.setString(20, ComPhone);
pstmt.setString(21, ContState);
pstmt.setString(22, ValidDate);
pstmt.setString(23, ExpireDate);
pstmt.setString(24,PolicyValue);
pstmt.setString(25,AutoTransferAccNo);
pstmt.addBatch();
pstmt.executeBatch();
System.out.print(&将XML导入数据库成功&);
}catch(Exception e){
e.printStackTrace();
DbUtil.close(pstmt);
DbUtil.close(conn);
(window.slotbydup=window.slotbydup || []).push({
id: '2467140',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467141',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467142',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467143',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467148',
container: s,
size: '1000,90',
display: 'inlay-fix'Oracle--JDBC读取Oracle LONG RAW类型字段插入图片 - 开发者博客 - ITeye技术网站
今天在项目中要向Oracle的LONG RAW形字段插入图片,以配合C/S的设计结构
项目中用Hibernate ORM,找了N久没有找到具体操作方法,终于花了2个多小时找到一个JDBC操作的例子,代码改造后为
import java.io.F
import java.io.FileInputS
import java.io.FileNotFoundE
import java.io.IOE
import java.sql.C
import java.sql.DriverM
import java.sql.PreparedS
import java.sql.SQLE
public class JdbcImgDAO {
//数据库连接方法
public static Connection getConnection(){
url="jdbc:oracle:thin:@192.168.0.100:1521:testdb";
Connection conn =
Class.forName("oracle.jdbc.driver.OracleDriver");
conn=DriverManager.getConnection(url,"user","pwd");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
//插入图片到案例库,id为主键,s为上传图片(路径+图片名)
public static void updateImg(String id, String s){
Connection conn = getConnection();
sql="update table t set t.img=? where id=?";
filename=new
//将文件的长度读出,并转换成Long型
l1=filename.length();
l2=(int)l1;
//以流的格式赋值
FileInputStream
FileInputStream(filename);
PreparedStatement
=conn.prepareStatement(sql);
ps.setBinaryStream(1,fis,l2);
//ps.setBinaryStream(1,fis,fis.available());
ps.setString(2,id);
ps.executeUpdate();
ps.close();
fis.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
conn.rollback();
} catch (SQLException e1) {
e1.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
显示图片页
&%@ page contentType=" charset=gbk"%&
&%@ page import="java.io.*"%&
&%@ page import="java.sql.*, javax.sql.*"%&
&%@ page import="java.util.*"%&
String id = request.getParameter("id");
String URL="jdbc:oracle:thin:@192.168.0.100:1521:testdb";
String user="user";
String password="pwd";
Connection con = DriverManager.getConnection(URL,user,password);
InputStream in =
ResultSet rs =
OutputStream out = response.getOutputStream();
Statement stmt = con.createStatement();
String sql = "select t.img from table t where id="+
rs = stmt.executeQuery(sql);
while(rs.next()) {
in = rs.getBinaryStream("img");
int len = 0;
byte[] byte = new byte[1024];
//response.setContentType("image/jpeg");
while ((len = in.read(byte)) != -1) {
out.write(byte,0,len);
out.close();
in.close();
}catch(Exception e){
e.printStackTrace();
rs.close();
con.close();
显示信息页面
&img src="img.jsp"&
开发者博客:
浏览: 131626 次
来自: 深圳用Java程序往oracle写入 和读出 图片 - 快乐源自成功 - ITeye技术网站
--------写入Oracle的图片
import java.io.Fimport java.io.FileInputSimport java.io.OutputSimport java.sql.Cimport java.sql.DriverMimport java.sql.PreparedSimport java.sql.ResultSimport java.sql.SQLE
import oracle.sql.BLOB;
public class JdbcDemo { public static void main(String[] args) {
JdbcDemo obj=new JdbcDemo();
obj.append_pic_to_Oracle(); } private void append_pic_to_Oracle() {
Connection conn=
BLOB blob=
int foodid=84;
//加载驱动
Class.forName("oracle.jdbc.driver.OracleDriver");
String url="jdbc:oracle:thin:@10.18.45.17:1521:orcl";
conn=DriverManager.getConnection(url,"wangjun","wangjun");
conn.setAutoCommit(false);
//把默认提交关闭,即开启了JDBC连接事务
//seq_foodinfo 是一个序列
String sql="insert into foodinfo values(seq_foodinfo.nextval,?,?,?,empty_blob(),?)";
PreparedStatement pstmt=conn.prepareStatement(sql);
pstmt.setString(1, "拉面");
pstmt.setString(2,"原料:青菜、猪肉、海带、骨头口味");
pstmt.setDouble(3, 4);
pstmt.setString(4, "好吃");
//没有返回值就用update
pstmt.executeUpdate();
pstmt.close();
strsql="select image from foodinfo where foodid=? for update";
//锁定即将要更新的记录
pstmt=conn.prepareStatement(strsql);
pstmt.setInt(1, foodid);
ResultSet rs= pstmt.executeQuery();
if(rs.next())
//当前找到blob
blob= (BLOB)rs.getBlob(1);
File f=new File("d:/funny/images/500024.jpg");
FileInputStream fis=
if(f.exists())
fis=new FileInputStream(f);
strsql="update foodinfo set image=? where foodid=?";
pstmt=conn.prepareStatement(strsql);
OutputStream os=blob.getBinaryOutputStream();
//为图片开辟一条缓存空间
byte[] buffer=new byte[(int)f.length()];
fis.read(buffer);
os.write(buffer);
fis.close();
os.close();
pstmt.setBlob(1, blob);
pstmt.setInt(2, foodid);
pstmt.executeUpdate();
} catch (Exception e) {
conn.rollback();
} catch (SQLException e1) {
e1.printStackTrace();
e.printStackTrace();
//连接不等于空或者没有关闭的时候
if(conn!=null || !conn.isClosed())
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
------------------------------------------------------------------------------
----------------在网页中输入图片
先建一个数据库的公用类
DBSession.java
import java.sql.Cimport java.sql.DriverMimport java.sql.SQLE
public class DBSession { private static final String DRIVER="oracle.jdbc.driver.OracleDriver"; private static final String URL="jdbc:oracle:thin:@10.18.45.17:1521:orcl"; private static final String USERNAME="wangjun"; private static final String PWD="wangjun"; public static Connection getConnection(){
Connection conn=
Class.forName(DRIVER);
conn=DriverManager.getConnection(URL,USERNAME,PWD);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} } public static void closeConn(Connection conn) {
if(conn!=null || !conn.isClosed())
conn.close();
} catch (SQLException e) {
e.printStackTrace();
在写一个取出图片的servlet 类
import java.io.IOEimport java.io.InputSimport java.io.OutputSimport java.sql.Bimport java.sql.Cimport java.sql.PreparedSimport java.sql.ResultSimport java.sql.SQLE
import javax.servlet.ServletEimport javax.servlet.http.HttpSimport javax.servlet.http.HttpServletRimport javax.servlet.http.HttpServletR
import m.DBS
public class GetPicture extends HttpServlet{
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String foodid =request.getParameter("foodid");
response.setContentType("image/jpg");
Connection conn=DBSession.getConnection();
String strsql="select image from foodinfo where foodid=?";
PreparedStatement
pstmt=conn.prepareStatement(strsql);
pstmt.setInt(1,Integer.parseInt(foodid));
ResultSet rs=pstmt.executeQuery();
if(rs.next())
Blob blob= rs.getBlob(1);
InputStream is= blob.getBinaryStream();
OutputStream os= response.getOutputStream();
byte[] buffer=new byte[1024*4];
int sss=0;
while((sss=is.read(buffer))!=-1)
os.write(buffer,0,sss);
is.close();
os.flush();
os.close();
} catch (SQLException e) {
e.printStackTrace();
DBSession.closeConn(conn);
} } protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException { }
在写一个jsp代码 能去取出代码
&title&&/title&
src="getPic?foodid=${param.foodid}" &
&/body&&/html&
浏览: 23813 次
来自: 上海
有开发能力还是建议去猪八戒威客网做做程序项目,项目比较多,收款 ...

我要回帖

更多关于 跟随音乐跳动频谱软件 的文章

 

随机推荐