求改错
import java.io.*;
import java.net.*;
import java.sql.*;
class ser1 implements Runnable{
ServerSocket ss;
Socket sc;
DataInputStream in=null;
DataOutputStream out=null;
InputStream in_data;
OutputStream out_data;
String str;
public ser1() {
try{
ss=new ServerSocket(1234);
while(true){
sc=ss.accept();
Thread m=new Thread(this);
m.start();
}
}
catch(
IOException ee){
System.out.println("错误");
}
}
public void run() {
try{
while(true){
in_data=sc.getInputStream();
out_data=sc.getOutputStream();
in=new DataInputStream(in_data);
out=new DataOutputStream(out_data);
str=in.readUTF();
out.writeUTF(str);
if(str.equals("end")){
in.close();
out.close();
sc.close();
}
}
}
catch(IOException e){
System.out.println("输入输出流错误");
}
}
}
class ser2 implements Runnable{
ServerSocket ss;
Socket sc;
DataInputStream in=null;
DataOutputStream out=null;
InputStream in_data;
OutputStream out_data;
String str;
String driver="sun.jdbc.odbc.JdbcOdbcDriver";
static String db="D:\\Java\\JavaWork\\NWIND.MDB";
String url1="jdbc:odbc:NWIND";
Connection conn=null;
Statement stmt=null;
PreparedStatement ps=null;
ResultSet rs=null;
String user="";
String pwd="";
String a="select * from 学生 where 姓名=";
String s1;
String s2;
public void connect()throws
SQLException {
try {
Class.forName(driver);
conn = DriverManager.getConnection(url1,user,pwd);
stmt = conn.createStatement();
rs=stmt.executeQuery(a+str);
while (rs.next()){
s1=rs.getString(1);
s2=rs.getString(2);
}
}catch (Exception e){
System.out.println(e);
}finally{
stmt.close();
conn.close();
}
}
public ser2() {
try{
ss=new ServerSocket(1234);
while(true){
sc=ss.accept();
Thread m=new Thread(this);
m.start();
}
}
catch(IOException ee){
System.out.println("错误");
}
}