四个本问题的贴子至今没有任何人可以回答,全部都是可以啊,行啊,没问题啊
没有任何代码证明我的信箱是 [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
没有任何代码证明我的信箱是 [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
Connection conn = DriverManager.getConnection(url,"test","123456");;
PreparedStatement statement = null;String photo="你数据库服务器上图片的完整地址(比如/tmp/test.jpg,不在服务器的要上传,可以利用jsp smartupload或struts等)";
File file = new File(photo);
FileInputStream fis = new FileInputStream(file);
int fileLength = (int)file.length();
photoStr = "insert into tab_photo(photo) values(?)";
statement = conn.prepareStatement(photoStr);
statement.setBinaryStream(1, fis, fileLength);
statement.executeUpdate();
statement.close();
fis.close();