js判断字符串是否包含某个字符串|jsp 连接Oracle 数据库四种方法

更新时间:2016-12-20    来源:js教程    手机版     字体:

【www.bbyears.com--js教程】

package dbbean;
import java.sql.*;
public class contactbean{
private connection con; //初始化连接。
public contactbean() {         
try  {   class.forname("oracle.jdbc.driver.oracledriver").newinstance();  
string url="jdbc:oracle:thin:@localhost:1521:hcm";         
string user="jsp教程dev";         
string password="19831007";         
con= drivermanager.getconnection(url,user,password);  

catch (instantiationexception e) 
{   // todo auto-generated catch block 
 e.printstacktrace(); 
 } catch (illegalaccessexception e) 
 {   // todo auto-generated catch block 
  e.printstacktrace(); 
  } 
   catch(classnotfoundexception e)  
   {   
   system.out.println("driver not found!");  
    con=null;  
 } 
 catch(sqlexception e)  
 {    con=null;   }
 }
 
 //代码二
 
class.forname("oracle.jdbc.driver.oracledriver").newinstance();?
string?url="jdbc:oracle:thin:@localhost:1521:orcl";?
//orcl为你的数据库教程的sid?
string?user="scott";?
string?password="tiger";?
connection?conn=?drivermanager.getconnection(url,user,password);?

//

class.forname("oracle.jdbc.driver.oracledriver").newinstance();?
string?url="jdbc:oracle:thin:@localhost:1521:orcl";?
//orcl为你的数据库的sid?
string?user="scott";?
string?password="tiger";?
connection?conn=?drivermanager.getconnection(url,user,password);?
statement?stmt=conn.createstatement(resultset.type_scroll_sensitive,resultset.concur_updatable
%>

本文来源:http://www.bbyears.com/wangyezhizuo/29141.html

猜你感兴趣

热门标签

更多>>

本类排行