Java jdbc exatracting user input

I've been working on a project involving JDBC and I've run into a problem. I'm trying to make a user interface (GUI by using swing) to a database that is implemented in MySQL. I can at this point to extract tables from the databases with set conditions but when I put the conditions as input from the interface They aren't read correctly and I can't figure why. this is the part of the code where i'm stuck;

String L=textField_3.getSelectedText();

sqlSt="select m.id,m.name,m.first_name,sum(t.payment),month(data_d) as 
month from student m inner join divertisment t on 
m.id=t.STUDENT_id\r\n" +"where (month(data_d)="+L+") group by m.id";
doQuery(sqlSt);

If I leave it as that it returns no table, but it should return at least 3 entries, if i put Integer.parseInt(L) it is saying there is a null pointer sent to doQuery. Can somebody help me ?

The tables are :

  CREATE TABLE IF NOT EXISTS `mydb`.`student` (
    `id` INT(11) NOT NULL,
   `name` VARCHAR(45) NULL DEFAULT NULL,
  `first_name` VARCHAR(45) NULL DEFAULT NULL,
 `study_year` INT NULL DEFAULT NULL,
 `adres` VARCHAR(45) NULL DEFAULT NULL,
 `temporary_residence` VARCHAR(45) NULL DEFAULT NULL,
 `member_buget` INT DEFAULT NULL,
 `passcode` INT(11) NOT NULL,
 PRIMARY KEY (`id`))


   CREATE TABLE IF NOT EXISTS `mydb`.`divertisment` (
 `activity` VARCHAR(45) NULL DEFAULT NULL,
 `payment` INT(11) NULL DEFAULT NULL,
 `data_d` DATETIME NULL DEFAULT NULL,
  ` STUDENT_id` INT(11) NOT NULL,
-- PRIMARY KEY (`STUDENT_id`),
 CONSTRAINT `fk_divertisment_STUDENT1`
   FOREIGN KEY (`STUDENT_id`)
   REFERENCES `mydb`.`student` (`id`)
   ON DELETE CASCADE
   ON UPDATE CASCADE)

Thank you!