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

dz̸Java´æ´¢¹ý³Ìµ÷ÓÃ(ת)


ÕâÀïΪ´ó¼Ò̸̸Java´æ´¢¹ý³Ìµ÷Óã¬ÎÒÃÇ¿ÉÒÔÀûÓÃJava´æ´¢¹ý³Ì¼ò»¯Êý¾Ý¿â²Ù×÷, ÀûÓÃJava´æ´¢¹ý³Ì¹µÍ¨SQL¡¢XML¡¢Java¡¢J2EEºÍWeb·þÎñ¡£
´´½¨ÐèÒªµÄ²âÊÔ±í:create table Test(tid varchar2(10),tname varchar2(10));
µÚÒ»ÖÖÇé¿ö£ºÎÞ·µ»ØÖµ.
create or replace procedure test_a(param1 in varchar2,param2 in varchar2)as  begin  insert into test values(param1,param2);  end; 
Javaµ÷ÓôúÂë:
package com.test;  import java.sql.*;  import java.io.*;  import java.sql.*;  public class TestProcA  {  public Test ProcA(){  }  public static void main(String[]args)  {  ResultSet rs=null;  Connection conn=null;  CallableStatement proc=null;  try{  Class.forName("oracle.jdbc.driver.OracleDriver");  conn=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:test","test","test");  proc=conn.prepareCall("{calltest_a(?,?)}");  proc.setString(1,"1001");  proc.setString(2,"TestA");  proc.execute();  }catch(Exception e){  e.printStackTrace();  }finally{  try{  if(null!=rs){  rs.close();   if(null!=proc){  proc.close();  }  if(null!=conn){  conn.close();  }  }  }catch(Exception ex){  }  }  }  } 
µÚ¶þÖÖÇé¿ö£ºÓзµ»ØÖµµÄ´æ´¢¹ý³Ì(·µ»ØÖµ·ÇÁбí).
´æ´¢¹ý³ÌΪ:
create or replace procedure test_b(param1 in varchar2,param2 out varchar2)  as  begin  select tname into param2 from test where tid=param1;  end; 
Javaµ÷ÓôúÂ룺
package com.test;  import java.sql.*;  import java.io.*;  import java.sql.*;  public class TestProcB  {  public TestProcB(){  }  public static void main(String[]args)  {  Connection conn=null;  CallableStatement proc=null;  try{  Class.forName("oracle.jdbc.driver.OracleDriver");  conn=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:test","test","test");  proc=conn.


Ïà¹ØÎĵµ£º

JavaɳÏäµÄʵÏÖ

JavaɳÏäʵÏÖÊÇÖØдÀà¼ÓÔØÆ÷ºÍ°²È«¹ÜÀíÆ÷,ͨ¹ýÉèÖõÄÈ«¾Ö°²È«¹ÜÀíÆ÷À´¿ØÖÆÖ´ÐгÌÐòµÄȨÏÞ
˵Ã÷: °²È«²ßÂÔÖ»¶Ô°²×°°²È«¹ÜÀíÆ÷Ö®ºóµÄÀàÉúЧ,֮ǰµÄÀ಻Ôٴ˹ÜÀí·¶Î§Ö®ÄÚ,ÀûÓÃÕâÒ»µã¿ÉÒÔÔ¤ÏÈÉèÖÃÎÒÃÇÐèÒªµÄ²Ù×÷,¶ø¶Ôij¸öµãÖ®ºóµÄËùÓзǷ¨²Ù×÷½øÐÐȨÏÞÉèÖÃ.
Àà¼ÓÔØÆ÷ÖØд
/**
* [ÖØдµÄÀà¼ÓÔØÆ÷]
* ɳÏä³ÌÐòÀà¼ÓÔØÆ÷,¿ ......

java¿ª·¢DB2³ÌÐò

1. JDBC Çý¶¯³ÌÐò

1.1 DB2 JDBC Type 2 Çý¶¯³ÌÐò

DB2 ¿Í»§»ú

²»½¨ÒéʹÓÃ

COM.ibm.db2.jdbc.app.DB2Driver µ÷ÓÃClass.forName() ·½·¨¡£

1.2 IBM DB2 ͨÓÃJDBC ºÍSQLJ Çý¶¯³ÌÐò

ÌṩÁËType 2 Á¬½ÓÐÔºÍType 4 Á¬½ÓÐÔ

¿ÉÒÔ½«Õâ¸öÇý¶¯³ÌÐòÓÃÓÚapp ......

javaÖеÄÅÅÐò»ã×Ü

 JAVAÅÅÐò»ã×Ü ÊÕ²Ø
package com.softeem.jbs.lesson4;
import java.util.Random;
/**
 * ÅÅÐò²âÊÔÀà
 *
 * ÅÅÐòËã·¨µÄ·ÖÀàÈçÏ£º
 * 1.²åÈëÅÅÐò£¨Ö±½Ó²åÈëÅÅÐò¡¢ÕÛ°ë²åÈëÅÅÐò¡¢Ï£¶ûÅÅÐò£©£»
 * 2.½»»»ÅÅÐò£¨Ã°ÅÝÅÝÅÅÐò¡¢¿ìËÙÅÅÐò£©£»
 * 3.Ñ¡ÔñÅÅÐò£¨Ö±½ÓÑ¡ÔñÅÅÐò¡¢¶ÑÅÅÐò£ ......

javaʵÏÖµÄstack pop·½·¨Ð¡Ï¸½Ú

 Ç°Ð©Ìì±àС³ÌÐò£¬Ð´ÆäÖÐÓÐÒ»¸ö×Ô¼ºÊµÏÖµÄstackµÄpopÈçÏ£º
public class Stack<T>{
 
   private ArrayList<T>  list;
   public Stack(){
          list =  new ArrayList<T>();
}
    ......

Java 7µÄÐÂÌØÐÔ

ÎÒ¸Õ´ÓÔÚAntwerpÕÙ¿ªµÄDevoxx
´ó»áÉÏ»ØÀ´£¬»áÉϽéÉÜÁËJava7µÄÐÂÌØÐÔ£¬¶ÔÓ¦µÄJDK½«ÓÚ2010Äê9Ô·¢²¼¡£
ÏÂÃæÊÇ7¸öÒѾ­Íê³ÉµÄÐÂÌØÐÔ£º
¶ÔcollectionsµÄÓïÑÔ¼¶Ö§³Ö
×Ô¶¯×ÊÔ´¹ÜÀí
¸Ä½ø·ºÐÍÔÚ´´½¨ÊµÀýʱµÄÀàÐÍÒýÓÃ
´øÏ»®ÏßµÄÊý×Ö
ÔÚswitchÖÐʹÓÃString
¶þ½øÖÆÎÄ×Ö
¼ò»¯µÄ¿É±ä²ÎÊý·½·¨µ÷ÓÃ
Java7»¹ÓкܶàÆäËûµÄÐÂÌØÐÔ£¬Î ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ