急急急......关于接入数据库的问题
我创建了个图形用户界面程序,是关于学生们用户管理界面的;
我有截图,但是其中有几个功能需要运用到数据库,我看了下树上的代码,具体是:
public void connect(String s){
Socket socket;
try{
socket=new Socket(InetAddress.getByName(""),3306);
//创建输入、输出流对象
output=new PrintStream(new BufferedOutputStream(socket.getOutputStream()));
input=new DataInputStream(new BufferedInputStream(socket.getInputStream()));
//输出数据流
output.println(s);
output.flush();
number.setText("");
name.setText("");
password.setText("");
college.setText("");
subject.setText("");
grade.setText("");
try{
//读取输入流
message=(String)input.readLine();
if(message.equals("addok"))
JOptionPane.showMessageDialog(null, "添加成功", "添加成功", JOptionPane.INFORMATION_MESSAGE);
else
JOptionPane.showMessageDialog(null, "添加失败", "添加失败", JOptionPane.WARNING_MESSAGE);
}
catch(IOException e){//捕获异常
System.out.println("无法获得信息");
}
//关闭输入输出数据流和Socket对象
output.close();
input.close();
socket.close();
}
catch(EOFException eof){//捕获异常
System.out.println("服务器中断");
}
catch(IOException e){//捕获异常
}
}
这里应该是要用到数据库吧,我去图书馆看了些书发现没有书写得很具体,这是其中一项添加功能之中的代码,只是想实现这些功能然后在仔细研究下!
请教各位具体怎么弄?图形用户界面是[code=Java][用NetBeans工具做的
我这有Navicate for MySQL
但是我不知道怎么