我经常由于要用一些包,但是有时找不到,比较浪费时间,所以把最近的一些包分享到这儿,方便别人的时候也方便自己。我会不定时更新,如果你有什么比较好的包,可以再评论中留言给我哦。我为人人,人人为我。
- JSON包
- mysql连接包
- oracle连接包
使用示例: [java]
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- public class MyDatabase {
- private static String driver = "oracle.jdbc.driver.OracleDriver";
- private static String url = "jdbc:oracle:thin:@127.0.0.1:1521:orcl";
- private static String user= "sjbase";
- private static String pw= "password";
- /**
- * @param args
- * @throws SQLException
- * @throws ClassNotFoundException
- */
- public static Connection getConnection() throws SQLException, ClassNotFoundException
- {
- Class.forName(driver);
- Connection conn=null;
- conn = DriverManager.getConnection(url, user, pw);
- return conn;
- }
- }
- axis包
使用示例: [java]
- Service service = new Service();
- Call call = (Call) service.createCall();
- call.setTargetEndpointAddress(this.getEndpoint());
- //设置操作名
- call.setOperationName("getSchoolInfo");
- //设置参数
- call.addParameter("username",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
- call.addParameter("userpassword",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
- //设置返回值类型
- call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
- //获取结果
- result = (String)call.invoke(new Object[]{this.getUsername(),this.getPassword()});