七郎's JavaBlog

草木竹石皆可為劒。至人之用人若鏡,不將不迎,應而不藏,故能勝物而不傷。
posts - 60, comments - 14, trackbacks - 0, articles - 0

JDBC直连ORC

Posted on 2007-05-18 17:04 七郎归来 阅读(249) 评论(0)  编辑  收藏

public static void main(String[] args) throws Exception {
  // TODO Auto-generated method stub
  String perCode="sgyyfj123";
  Connection con;
  Statement stmt;
  ResultSet rs;
  Class.forName("oracle.jdbc.driver.OracleDriver");
  con = DriverManager.getConnection("jdbc:oracle:thin:@10.194.129.49:1521:test", "gdcrm", "gdcrm");
  stmt = con.createStatement();
  rs = stmt.executeQuery("select * from bbscs_userinfo where username='"+perCode+"'");
  if(rs.next()){
   System.out.print("有有有有有");
  }else{
   System.out.print("没没没没没");
   stmt.execute("insert into bbscs_userinfo(ID,USERNAME,NICKNAME,PASSWD,REPASSWD,EMAIL,QUESTION,ANSWER,LOGINTIME,LOGOUTTIME,LOGINTIMES,POST,EXP,EXPRESSION,ARTICLENUM,STAYTIME,POWER,HPOWER) " +
     "values(BBSCS_USERINFO_SEQ.NEXTVAL,'"+perCode+"','"+perCode+"',000,000,'admin@crm.gdcrm.com.cn','admin','gdcrm',10,10,10,10,10,10,10,10,10,10)");
  }
   

}


只有注册用户登录后才能发表评论。


网站导航: