Oracle的驱动名称

驱动名称:oracle.jdbc.driver.OracleDriver

相关链接:http://blog.csdn.net/java_cxrs/article/details/3929704


下面是案例:
package test1;

import java.sql.Connection;
import java.sql.DriverManager;

public class TestConnection {
	public static void main(String[] args) throws Exception{
		//JDBC的编程步骤:
		//1.注册驱动
		Class.forName("oracle.jdbc.driver.OracleDriver");
		/*2.获取链接: (1)param1:要链接数据库的URL
		 * 	       (2)param1:要链接数据库的用户名
		 *  	       (3)param1:要链接数据库的密码
		*/		
		Connection con= DriverManager.getConnection(
				"jdbc:oracle:thin:@10.10.22.11:1521:orcl", 
				"scott", 
				"scott123");
		System.out.println(con);
		//6.关闭资源
		con.close();
	}
}

你可能感兴趣的:(JAVA)