JDBC Connect Oracle and MySQL Database Database

xiaoxiao2021-03-06  69

Import java.sq. *; connection conn = null; statement stmt; resultset rs; string sql = "select * from tab";

// con = DriverManager.getConnection ("JDBC: POOLMAN: / / TGPMS-HELP"); / / Connect Oracle Database Class.Forname ("Oracle.jdbc.driver.Oracledriver). NewInstance (); conn = drivermanager.getConnection ("JDBC: Oracle: Thin: @ 192.168.15.248: 1521: YCDB", "WebcfcQuery", "Kill859"); // Connect the mysql database class.Forname ("org.gjt.mm.mysql.driver). NewInstance (); Conn = drivermanager.getConnection ("JDBC: MySQL: // LocalHost / Meeting", "Root", "21cent"); stmt = con.createstatement (); rs = stmt.executeQuery (SQL); rs.close (); Stmt.close (); con.close ();

转载请注明原文地址:https://www.9cbs.com/read-109664.html

New Post(0)