JAVAµ÷ÓÃMYSQL´æ´¢¹ý³Ì
JAVAµ÷ÓÃMYSQL´æ´¢¹ý³Ì
¹¤³ÌÊÓͼ£º
´úÂëÇåµ¥£º
myconn.java
package org.apache.sh_mysql.test;
import java.sql.*;
public class MyConn {
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost/test?useUnicode=true&characterEncoding=GBK";
private static final String USER = "root";
private static final String PASSWORD ="root";
static {
try {
Class.forName(DRIVER);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* »ñÈ¡Á¬½Ó
*
* @return
* @throws Exception
*/
public Connection getConnection() throws Exception {
return DriverManager.getConnection(URL, USER, PASSWORD);
}
/**
* ÊÍ·Å×ÊÔ´
*
* @param rs
* @param statement
* @param conn
*/
public void close(ResultSet rs, CallableStatement stmt, Connection conn) {
try{
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
if (conn != null) {
conn.close();
}
}catch(Exception e){
e.printStackTrace();
}
}
}
´úÂëÇåµ¥£º
mytest.java
package org.apache.sh_mysql.test;
import java.sql.*;
public class MyTest {
MyConn c=new MyConn();
public void handleData() {
try {
Connection conn=c.getConnection();
CallableStatement call=conn.prepareCall("{call pro_stu_count(?)}");
call.registerOutParameter(1, Types.INTEGER);
call.execute();
int count=call.getInt(1);
System.out.println(count);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
public static void main(String[] args) {
MyTest t=new MyTest();
t.handleData();
}
}
Ïà¹ØÎĵµ£º
×î½ü¹«Ë¾Åöµ½ÐèÒªÓÃͼ±íµÄÐÎʽÏÔʾһЩÊý¾Ý£¬ÎҾͿªÊ¼µ½ÍøÉϲéѯ£¬²éµ½ÁËjfreechartºÍamcharts,ÕâÁ½ÕßÎÒ¶¼ÊµÏÖ¹ýÁË£¬jfreechart×îºóÉú³ÉͼƬ£¬µ«ÊÇͼƬЧ¹û²»ÊÇÎÒÏëÒªµÄ£¬È»ºóÓÖÑо¿amcharts ËüµÄЧ¹ûȷʵºÜºÃ£¬¶øÇÒ¹Ù·½ÍøÕ¾ÉÏ»¹ÓкÃЩÀý×ӿɹ©ÏÂÔØ£¬ÍøÖ·ÊÇ:www.amcharts.com
£¨ÏëÒªÍê³ÉÒ»¸öamchartsͼÐÎÐèÒªswfobjects. ......
ÒÔÇ°¶¼ÊÇÓÃÒ»°ãµÄsocket±à³Ì£¬ÓÃÏß³ÌÀ´¿ØÖÆ¡£×î½üͻȻÓÃnioÀ´×öЩ¶«Î÷¡£
nioµÄºÃ´¦ÎÒÀ´ËµÒ»Ï£ºµÚÒ»£¬¶Áд¶¼ÊÇ»ùÓÚ¿éµÄ£¬Ð§Âʸߡ£µÚ¶þ£¬Í¨¹ýÒýÈëselector,¼ò»¯ÁËÍøÂç±à³ÌÄ£ÐÍ£¬Òì²½·Ç×èÈû¡£
¼ÈÈ»ÓÐÕâô¶àºÃ´¦£¬ÄǾÍд¸öNIO TCPÍøÂçÁÄÌìÊÒÀ´Á·Á·ÊÖ°É¡£
ÒòΪûÓÐдgui£¬ÊÇ»ùÓÚ¿ØÖÆ̨µÄËùÒÔûд˽Á˵IJ¿·Ö£¬Ö»Ð´Á˹«¹²ÁÄÌìÊ ......
Îå¸öÓÐÓõĹýÂËÆ÷
Ò»¡¢Ê¹ä¯ÀÀÆ÷²»»º´æÒ³ÃæµÄ¹ýÂËÆ÷
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* ÓÃÓÚµÄʹ Browser ²»»º´æÒ³ÃæµÄ¹ýÂËÆ÷
*/
public class ForceNoCacheFilter implements Filter { ......
ʵ²»ÏàÂ÷£¬JavaÊÇÎÒ¼û¹ýµÄÖ´ÐÐЧÂÊ×îµÍµÄ³ÌÐòÉè¼ÆÓïÑÔ£¬Ç°²»¾ÃÔÚCSDNÂÛ̳ÉÏÓиöÆÀ²â£¬¼ÆËã9999µÄ½×³Ë£¬Í¬ÑùµÄÑ»·Ëã·¨£¬JavaµÄºÄʱÊÇ.NETµÄ5±¶¡£ÎÒÒÔÇ°ºÜϲ»¶Serv-U£¬×Ô´ÓËüÓÃJavaÖØд֮ºóÎÒ¾ÍÔÙҲûÓùý£¬ÊµÔÚÊÇÌ«ÂýÁË£¬ÎÒÄþ¿ÉÓÃIIS´î½¨FTP£¬ËäÈ»IIS´î½¨FTPÔÚȨÏÞ¹ÜÀíÉϺܲ»Áé»î¡£
ÎÒÓиöͬѧ£¬ËûÊǸãJavaµÄ£¬Ëû¸øÎÒ˵&ld ......
ÖØÔØ£º·½·¨ÃûÏàͬ ·µ»ØÀàÐͺͲÎÊýÖÁÉÙÓÐÒ»Ïͬ£¨²ÎÊý°üÀ¨ÀàÐÍ ºÍ ÊýÁ¿£©
ÖØд£º·¢ÉúÔÚ×ÓÀà ·½·¨Ãû ·µ»ØÀàÐÍ ²ÎÊý¶¼Ïàͬ Ö»ÊǰѸ¸ÀàµÄ´Ë·½·¨ÖØÐÂд¶øÒÑ
Ò»Ö±ÒÔÀ´ÎÒ¶ÔFacther f = new Son()ÕâÑùµÄÒýÓñäÁ¿ÒýÓÃ×ÓÀàµÄʵÀý¶¼²»ÊǺܶ®¡£
»¹ÓоÍÊÇÏòÉÏÏòÏÂתÐÍ
È磺Animal animal = new Dog() // ÒýÓñäÁ¿ÒýÓÃÁËÀ´×Ô×ÓÀàµÄÊ ......