package zdzy;
import java.io.PrintStream;
import java.sql.*;
public class DATALINEdby
{
public DATALINEdby()
{
con = null;
stmt = null;
rs = null;
url = "jdbc:oracle:thin:@192.168.68.222:1521:ora8";
user = "jjweb";
password = "jjweb";
try
{
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
}
catch(ClassNotFoundException classnotfoundexception)
{
System.out.println(classnotfoundexception.getMessage());
}
catch(Exception exception)
{
System.out.println(exception.getMessage());
}
}
public ResultSet execute(String s)
{
rs = null;
try
{
con = DriverManager.getConnection(url, user, password);
Statement statement = con.createStatement();
rs = statement.executeQuery(s);
}
catch(SQLException sqlexception)
{
System.out.println(sqlexception.getMessage());
}
catch(Exception exception)
{
System.out.println(exception.getMessage());
}
return rs;
}
public String inStr(String s)
{
if(s == null)
s = "";
else
try
{
s = (new String(s.getBytes("iso-8859-1"), "GB2312")).trim();
s = s.replace('/'', '/001');
}
catch(Exception exception)
{
exception.printStackTrace(System.err);
}
return s;
}
public void executeUpdate(String s)
{
try
{
con = DriverManager.getConnection(url, user, password);
Statement statement = con.createStatement();
statement.executeUpdate(s);
}
catch(SQLException sqlexception)
{
System.out.println("sqlexception:" + sqlexception);
}
catch(Exception exception)
{
System.out.println("an unknow error occured");
}
}
Connection con;
Statement stmt;
ResultSet rs;
String url;
String user;
String password;
}