package mydata;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
import java.sql.*;
public class Bean1 {
java.sql.Connection conn=null;
java.sql.ResultSet rs=null;
java.sql.Statement stat=null;
public Bean1() {
try
{
java.lang.Class.forName("oracle.jdbc.driver.OracleDriver");
conn = java.sql.DriverManager.getConnection("jdbc
racle:thin
127.0.0.1:1521:ORA817","system","manager");
stat=conn.createStatement();
}
catch (Exception e)
{
System.out.println("Err" + e.getMessage());
}
}
public void db()
{
try{
stat.execute("insert into yw_ycrz.czy values ('123','121','1331','121')");
conn.commit();
rs=stat.executeQuery("select * from yw_ycrz.czy where id='"+123+"'");
while (rs.next())
{
//System.out.println(rs.getString(0));
System.out.println(rs.getString(1));
System.out.println(rs.getString(2));
System.out.println(rs.getString(3));
System.out.println(rs.getString(4));
}
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
public static void main(String[] args)
{
Bean1 t =new Bean1();
t.db();
}
}