JAVA 常用包

来源:互联网 发布:steam动态桌面软件 编辑:程序博客网 时间:2024/06/05 14:36

我经常由于要用一些包,但是有时找不到,比较浪费时间,所以把最近的一些包分享到这儿,方便别人的时候也方便自己。我会不定时更新,如果你有什么比较好的包,可以再评论中留言给我哦。我为人人,人人为我。

  • JSON包  下载地址点这里   
               使用示例: http://www.cnblogs.com/mailingfeng/archive/2012/01/18/2325707.html
  • mysql连接包   下载地址点这里
                使用示例: http://www.cnblogs.com/Soplayer/archive/2007/06/26/796565.html
  • oracle连接包     下载地址点这里
               使用示例:
[java] view plaincopy
  1. import java.sql.Connection;  
  2. import java.sql.DriverManager;  
  3. import java.sql.SQLException;  
  4.   
  5. public class MyDatabase {  
  6.   
  7.     private static String driver = "oracle.jdbc.driver.OracleDriver";  
  8.   
  9.     private static String url = "jdbc:oracle:thin:@127.0.0.1:1521:orcl";  
  10.     private static String user= "sjbase";  
  11.     private static String pw= "password";  
  12.       
  13.     /** 
  14.      * @param args 
  15.      * @throws SQLException  
  16.      * @throws ClassNotFoundException  
  17.      */  
  18.     public static Connection getConnection() throws SQLException, ClassNotFoundException  
  19.     {  
  20.         Class.forName(driver);  
  21.         Connection conn=null;  
  22.         conn = DriverManager.getConnection(url, user, pw);  
  23.         return conn;  
  24.     }  
  25.   
  26. }  

  • axis包                下载地址点这里
             使用示例:
              
[java] view plaincopy
  1. Service service = new Service();  
  2. Call call = (Call) service.createCall();  
  3. call.setTargetEndpointAddress(this.getEndpoint());  
  4. //设置操作名  
  5. call.setOperationName("getSchoolInfo");  
  6. //设置参数  
  7. call.addParameter("username",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);  
  8. call.addParameter("userpassword",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);  
  9. //设置返回值类型  
  10. call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);  
  11. //获取结果  
  12. result =  (String)call.invoke(new Object[]{this.getUsername(),this.getPassword()});  
0 0
原创粉丝点击