ÓÃJAVAдÈëºÍ¶ÁÈ¡MYSQLµÄͼƬµÄʵÀý
Ö÷ÒªµÄ³ÌÐò£º
package greeds.jdbc.sample;
import greeds.jdbc.util.JDBCUtil;
import java.io.*;
import java.sql.*;
public class MySQLBlobSample {
public static void main(String[] args) throws Exception {
// дÈëÊý¾Ý¿â
/*
*
* Connection conn = null; PreparedStatement pstm = null;
*
* try { String filepath = "D:\\strahovski-ep201-011.jpg"; File file =
* new File(filepath); FileInputStream fin = new FileInputStream(file);
* conn = JDBCUtil.getConnection();
*
* String sql = "insert into Dish(id,photo) values(?,?)"; pstm =
* conn.prepareStatement(sql); pstm.setInt(1, 3);
* pstm.setBinaryStream(2, fin,(int)file.length());
*
* int r = pstm.executeUpdate(); System.out.println("INSERT"+r+"ROW");
*
* fin.close();
*
*
* } catch (FileNotFoundException e) { e.printStackTrace(); } finally{
* //JDBCUtil.release(null, pstm, conn); }
*/
// ´ÓÊý¾Ý¿â¶ÁÈ¡Îļþ
Connection conn = null;
Statement stm = null;
ResultSet rs = null;
try {
conn = JDBCUtil.getConnection();
stm = conn.createStatement();
String sql = "select * from Dish where id=1";
rs = stm.executeQuery(sql);
rs.next();
Blob blob = rs.getBlob("photo");
FileOutputStream out = new FileOutputStream(new File("E:/my.jpg"));
InputStream in = blob.getBinaryStream();
int i;
while ((i = in.read()) != -1) {
out.write(i);
}
in.close();
out.close();
} catch (Exception e) {
e.pr
Ïà¹ØÎĵµ£º
ÀàµÄ³õʼ»¯ºÍ¶ÔÏó³õʼ»¯ÊÇ JVM ¹ÜÀíµÄÀàÐÍÉúÃüÖÜÆÚÖзdz£ÖØÒªµÄÁ½¸ö»·½Ú£¬Google ÁËÒ»±éÍøÂ磬ÓйØÀà×°ÔØ»úÖƵÄÎÄÕµ¹ÊDz»ÉÙ£¬È»¶øÀà³õʼ»¯ºÍ¶ÔÏó³õʼ»¯µÄÎÄÕ²¢²»¶à£¬ÌرðÊÇ´Ó×Ö½ÚÂëºÍ JVM ²ã´ÎÀ´·ÖÎöµÄÎÄÕ¸üÊÇÏÊÓÐËù¼û¡£
±¾ÎÄÖ÷Òª¶ÔÀàºÍ¶ÔÏó³õʼ»¯È«¹ý³Ì½øÐзÖÎö£¬Í¨¹ýÒ»¸öʵ¼ÊÎÊÌâÒýÈ룬½«Ô´´úÂëת»»³É JVM ×Ö½ÚÂëºó£¬ ......
²éѯ¼°É¾³ýÖظ´¼Ç¼µÄ·½·¨
(Ò»)
1¡¢²éÕÒ±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨peopleId£©À´ÅжÏ
select * from people
where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)
2¡¢É¾³ý±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨peopleId£©À´Åжϣ¬Ö»Á ......
iMarine http://iMarine.blog.163.com
×¢Ã÷£º±¾Îĵµ²Î¿¼Jena 2.5Îĵµ£¬Ê¹ÓÃJena 2.5 APIºÍMySQL 5.0.4-beta-ntÊý¾Ý¿â¡£MySQLÇý¶¯°üʹÓõÄÊÇmysql-connector-java-3.1.10-bin.jar¡£
1 JenaµÄÊý¾Ý¿â½Ó¿Ú
JenaÌṩÁ˽«RDFÊý¾Ý´æÈë¹ØϵÊý¾Ý¿âµÄ½Ó¿Ú£¬Model¡¢Resource¡¢QueryµÈ½Ó¿Ú¿ÉÒÔÓÃÓÚ·ÃÎʺÍά»¤Êý¾Ý¿âÀïµÄRDFÊý ......
1.ÄãÐèÒª¾«Í¨ÃæÏò¶ÔÏó·ÖÎöÓëÉè¼Æ(OOA/OOD)¡¢É漰ģʽ(GOF£¬J2EEDP)ÒÔ¼°×ÛºÏģʽ¡£ÄãÓ¦¸ÃÊ®·ÖÁ˽âUML£¬ÓÈÆäÊÇclass£¬object£¬interactionÒÔ¼°statediagrams¡£
¡¡¡¡2.ÄãÐèҪѧϰJAVAÓïÑԵĻù´¡ÖªÊ¶ÒÔ¼°ËüµÄºËÐÄÀà¿â(collections£¬serialization£¬streams£¬networking£¬ multithreading£¬reflection£¬event£ ......
½ñÌìÖÕÓÚ°ÑJAVAÀïÒ»¸ö±È½ÏÍ·Í´µÄÎÊÌâ——×Ö·û±àÂëŪÇåÎúÁË£¬ËùÒÔдһƪÎÄÕÂÀ´¼ÍÄîһϣ¬Ò²Îª´ó¼ÒÌṩһµã×Ô¼ºµÄÐĵá£
¡¡¡¡ÖÚËùÖÜÖª£¬JAVAΪÁ˹ú¼ÊͨÓã¬ÓõÄÊÇUNICODEÀ´±£´æÀïÃæµÄ×Ö·û¡£¶øUNICODEÖ»ÊÇÒ»¸öÖÖ×Ö·û¼¯£¬×Ö·ûµÄ´æ´¢ºÍ±íʾҪÓõ½Ò»¶¨µÄ×Ö·û±àÂë¸ñʽ£¬¶øÓëUNICODE¶ÔÓ¦µÄ×Ö·û±àÂë¸ñʽ¾ÍÊÇÎÒÃdz£¿´µ½µÄU ......