求助:jsp连接oracle9i
我是新手
大虾们能给我一个jsp连接oracle9i的简单方法吗?
我的jsp环境是j2sdk1.4.1+Tomcat6.0
谢谢大家!!
------解决方案--------------------google中搜索 JDBC oralce 实例
------解决方案--------------------Class.forName( "oracle.jdbc.driver.OracleDriver ").newInstance();
con = DriverManager.getConnection "jdbc:oracle:thin:@uri:1521:dataBase ", "user ",
"password ");
------解决方案--------------------import oracle.jdbc.driver.*;
public java.sql.Connection connDbByThin(){
java.sql.Connection conn = null;
try{
Class.forName( "oracle.jdbc.driver.OracleDriver ");
conn = DriverManager.getConnectio( "jdbc:oracle:thin:@localhost:1521:#serviceName# ",#usrename#,#password#);
}catch (Exception e){
System.out.println( "Error: "+e.getMessage());
}
return conn;
}