[ create a new paste ] login | about

Link: http://codepad.org/cP1KJbH9    [ raw code | output | fork ]

C, pasted on Oct 10:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package n16dccn029dangnhatduy_sangthu5;
import java.io.*;
import java.util.*;
import java.net.DatagramSocket;
import java.net.DatagramPacket;
import java.sql.Connection;
import java.sql.DriverManager;
/**
 *
 * @author Admin
 */
public class Server {
    public final static int PortServer = 7;
    public final static byte[] inFromClient1 = new byte[2048];
    public final static byte[] inFromClient2 = new byte[2048];
    public final static byte[] inFromClient3 = new byte[2048];
    
    public static String host = "jdbc:sqlserver://localhost:";
    public static String dbName = "DatabaseName=LTM5";
    public static String dbUser = "sa";
    public static String dbPort = "1433;";
    public static String dbPass = "123";
    public static void main(String[] args) {
        DatagramSocket ds = null;
        try {
            ds = new DatagramSocket(PortServer);
            System.out.println("Server đã sẵn sàng, đang chờ kết nối từ Client...");
            
            // kết nối sql
            String url = host + dbPort + dbName;
            Connection connection = DriverManager.getConnection(url, dbUser, dbPass);
            java.sql.Statement statement = connection.createStatement();
            
            // nhận từ client
            DatagramPacket dp_SV = new DatagramPacket(inFromClient1, inFromClient1.length);
            DatagramPacket dp_DMMH = new DatagramPacket(inFromClient2, inFromClient2.length);
            DatagramPacket dp_KQ = new DatagramPacket(inFromClient3, inFromClient3.length);
            
            ds.receive(dp_SV);
            ds.receive(dp_DMMH);
            ds.receive(dp_KQ);
            
            String SinhVien = new String(dp_SV.getData(), 0, dp_SV.getLength());
            statement.executeUpdate(SinhVien);
            String DMMH = new String(dp_DMMH.getData(), 0, dp_DMMH.getLength());
            statement.executeUpdate(DMMH);
            String KetQua = new String(dp_KQ.getData(), 0, dp_KQ.getLength());
            statement.executeUpdate(KetQua);
            
            statement.close();
            connection.close();
        }
        catch(Exception e) {
            System.out.println("Lỗi " +e);
        }
    }
}


Output:
1
2
3
4
5
6
7
8
Line 6: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'n16dccn029dangnhatduy_sangthu5'
Line 7: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'java'
Line 8: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'java'
Line 9: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'java'
Line 10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'java'
Line 11: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'java'
Line 12: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'java'
Line 17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'class'


Create a new paste based on this one


Comments: