是不是java,jdbc不可能向mysql数据库储存二进制文件? 是不是mysql的问题mysql这个咚咚以前很多特性都不支持不知现在怎样了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 看看你的inputStream x 有没有读到内容? 同意楼上的,另外更新一下mysql版本,版本低的确实很多功能都没有,你可以研究一下mysql的手册 楼上的各位同志,MySQL是没有问题的,JDBC也是没有问题的。这些东西我都做过,可以实现的。我把各个相版存到MySQL中去 ,然后再读出来,都实现了,没有问题,估计是楼主的有些方法的参数没有用对。 另外楼主说在个java版问了400多分了,不知道是不是真的,我这几天天天上CSDN的,还没有看到这样的贴子呀?如果楼主要代码的吗,我可以发给你。楼主的信誉值好低呀!:D 谁说的不能呀,不过我是用hibernate做的,JDBC肯定也可以撒 四个本问题的贴子至今没有任何人可以回答,全部都是可以啊,行啊,没问题啊没有任何代码证明我的信箱是 [email protected]收到可行代码立刻结贴送分http://community.csdn.net/Expert/topic/3638/3638776.xml?temp=.6011927http://community.csdn.net/Expert/topic/3637/3637320.xml?temp=.0927698http://community.csdn.net/Expert/topic/3638/3638807.xml?temp=.9520227http://community.csdn.net/Expert/topic/3638/3638773.xml?temp=.4013636 插入/查询正常。的确可以,这是数据库一般的功能。try { Class.forName("org.gjt.mm.mysql.Driver").newInstance(); String url ="jdbc:mysql://localhost/test?user=root&password=root&useUnicode=true&characterEncoding=gbk"; Connection conn = DriverManager.getConnection(url); Statement stmt = conn.createStatement(); stmt.execute("insert into test(myid) values (5)"); stmt.close(); PreparedStatement pstmt = null; String sql = ""; File file = new File("c:\\kick.jpg"); InputStream photoStream = new FileInputStream(file); sql = " UPDATE test SET photo = ? WHERE myid = 5" ; pstmt = conn.prepareStatement(sql); pstmt.setBinaryStream(1, photoStream, (int)file.length()); pstmt.executeUpdate(); pstmt.close(); conn.close();} catch (Exception e) { e.printStackTrace();} Syntax error or access violation语法错误 java问题 求知道学习顺序 【struts1.2】我又测试不通了.. tomcat启动时,怎么取得工程URL地址 坛子里有没有成都的朋友 HIBERNATE为什么只循环第一条数据呢 SSH中,spring获取对象的问题 Struts2 FORM提交修改后数据正常修改 但是总跳回到起始页 跪求高人指点 请问哪里有sping包下载? 新手学orcal遇到错误求前辈指点解决 菜鸟学struts,入门级问题! hibernate的映射问题!!
楼主的信誉值好低呀!:D
没有任何代码证明我的信箱是 [email protected]
收到可行代码立刻结贴送分
http://community.csdn.net/Expert/topic/3638/3638776.xml?temp=.6011927
http://community.csdn.net/Expert/topic/3637/3637320.xml?temp=.0927698
http://community.csdn.net/Expert/topic/3638/3638807.xml?temp=.9520227
http://community.csdn.net/Expert/topic/3638/3638773.xml?temp=.4013636
try {
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url ="jdbc:mysql://localhost/test?user=root&password=root&useUnicode=true&characterEncoding=gbk";
Connection conn = DriverManager.getConnection(url);
Statement stmt = conn.createStatement();
stmt.execute("insert into test(myid) values (5)");
stmt.close();
PreparedStatement pstmt = null;
String sql = "";
File file = new File("c:\\kick.jpg");
InputStream photoStream = new FileInputStream(file);
sql = " UPDATE test SET photo = ? WHERE myid = 5" ;
pstmt = conn.prepareStatement(sql);
pstmt.setBinaryStream(1, photoStream, (int)file.length());
pstmt.executeUpdate();
pstmt.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
}