Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JAVAÖÐOracleÈ¡Öµ

package com.svse.dao;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UserDAO {
/*
* javaµ÷Óô洢¹ý³Ì
*/
public int addUser(String username,int userage)
{
Connection conn = null;
int userid =0;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@192.168.13.142:1521:ORCL","scott","tiger");
//µ÷Óùý³Ì
CallableStatement cs = conn.prepareCall("{ call proc_addUser(?,?,?) }");
cs.setString(1, username);
cs.setInt(2, userage);
//¶ÔÓÚÊä³ö²ÎÊý ÄÇôÐèÒª»ñÈ¡ËüµÄÖµ
//1 ÐèҪע²á¸Ã²ÎÊýµÄ ÀàÐÍ
cs.registerOutParameter(3, java.sql.Types.INTEGER);
//µ÷Óô洢¹ý³Ì
cs.execute();
//»ñÈ¡´æ´¢µÄÊä³ö²ÎÊý
userid = cs.getInt(3);
conn.close();

} catch (Exception e) {
e.printStackTrace();
}
return userid;


}

public static void main(String[] args) {
UserDAO dao = new UserDAO();
int userid = dao.addUser("ÍõÂé×Ó",19);
System.out.println(userid);
}


}


Ïà¹ØÎĵµ£º

sql 2005 ´æ´¢¹ý³Ì·ÖÒ³ java ´úÂë

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ ......

finalÔÚjavaÖеÄÓ¦ÓÃ

finalÔÚJavaÖв¢²»³£Óã¬È»¶øËüȴΪÎÒÃÇÌṩÁËÖîÈçÔÚCÓïÑÔÖж¨Òå³£Á¿µÄ¹¦ÄÜ£¬²»½öÈç´Ë£¬final»¹¿ÉÒÔÈÃÄã¿ØÖÆÄãµÄ³ÉÔ±¡¢·½·¨»òÕßÊÇÒ»¸öÀàÊÇ·ñ¿É±»¸²Ð´»ò¼Ì³ÐµÈ¹¦ÄÜ£¬ÕâЩÌصãʹfinalÔÚJavaÖÐÓµÓÐÁËÒ»¸ö²»¿É»òȱµÄµØ룬ҲÊÇѧϰJavaʱ±ØÐëÒªÖªµÀºÍÕÆÎյĹؼü×ÖÖ®Ò»¡£
final³ÉÔ±
¡¡¡¡ µ±ÄãÔÚÀàÖж¨Òå±äÁ¿Ê±£¬ÔÚÆäÇ°Ãæ¼ÓÉÏfi ......

Java WebÖнâ¾öÖÐÎÄÂÒÂë

ÔÚMVCÖÐÅäÖñàÂëfilter¿ÉÒÔ½â¾öÖÐÎÄÂÒÂëÎÊÌâ
--------------------------------------------------------------------------------------------------------------------------------------------------
ÔÚweb.xmlÖмÓÈëÈçÏÂfilter´úÂ룺
    <!--Form content submit encoding filter start-->
& ......

JAVAÖ®IOÁ÷(³¬ÏêϸµÄJava.io°üµÄ½éÉÜ!)

JAVAÖ®IOÁ÷(³¬ÏêϸµÄJava.io°üµÄ½éÉÜ!)
Ò».InputºÍOutput
1.stream´ú±íµÄÊÇÈκÎÓÐÄÜÁ¦²ú³öÊý¾ÝµÄÊý¾ÝÔ´£¬»òÊÇÈκÎÓÐÄÜÁ¦½ÓÊÕÊý¾ÝµÄ½ÓÊÕÔ´¡£
ÔÚJavaµÄIOÖУ¬ËùÓеÄstream£¨°üÀ¨InputºÍOut stream£©¶¼°üÀ¨Á½ÖÖÀàÐÍ£º
1.1 ÒÔ×Ö½ÚΪµ¼ÏòµÄstream
ÒÔ×Ö½ÚΪµ¼ÏòµÄstream£¬±íʾÒÔ×Ö½ÚΪµ¥Î»´ÓstreamÖжÁÈ¡»òÍùstreamÖÐдÈëÐÅÏ ......

Java»ñÈ¡¸÷ÖÖ³£ÓÃʱ¼ä·½·¨

package com.test;


import java.text.DateFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class TimeTest {
//ÓÃÀ´ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ