Oracle 与在Java中的链接
转帖处:http://dong-java.javaeye.com/blog/375150
1。推荐使用Oralce比较新的10.2.0.3 JDBC Drivers。这个版本对比9.2的最大的好处是DriverManager.setLoginTimeout函数是起作用的。设置了这个参数,在恶劣的网络环境中就不会有连接数据库的函数长时间不返回的情况。
2。JDBC Developer!ˉs Guide and Reference 10g Release 2 (10.2)
给出的连接数据库的示例:
import java.sql.*;
import oracle.jdbc.pool.OracleDataSource;
class JdbcTest {
public static void main (String args []) throws SQLException {
// Create DataSource and connect to the local database
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@//myhost:1521/orcl");
ods.setUser("scott");
ods.setPassword("tiger");
Connection conn = ods.getConnection();
// Query the employee names
Statement stmt = conn.createStatement ();
ResultSet rset = stmt.executeQuery ("SELECT ename from emp");
// Print the name out
while (rset.next ())
System.out.println (rset.getString (1));
//close the result set, statement, and the connection
rset.close();
stmt.close();
&n
相关文档:
1.计算某一月份的最大天数
Calendar time=Calendar.getInstance();
time.clear();
time.set(Calendar.YEAR,year);
time.set(Calendar.MONTH,i-1);//注意,Calendar对象默认一月为0
int day=time.getActualMaximum(Calendar.DAY_OF_MONTH);//本月份的天数 ......
1、FACTORY(工厂模式)
2、BUILDER(建造模式)
3、FACTORY METHOD(工厂方法模式)
4、PROTOTYPE(原始模型模式)
5、SINGLETON(单例模式)
6、ADAPTER(适配器模式)
7、BRIDGE(桥梁模式)
8、COMPOSITE(合成模式)
9、DECORATOR(装饰模式)
10、FACADE(门面模式)
11、FLYWEIGHT(享元模式) ......
1 网络通信的本质是进程间通信。
2 Tcp协议和UDP协议
TCP:开销大,用于可靠性要求高的场合。
TCP的过程相当于打电话的过程
UDP:用在对实时性要求比较高的场合。
UDP的过程相当于写信的过程。
注意:socket是套接字,ip和port(端口号 0~65535个端口,一个端口只能有一个进程)
3,   ......