Мой массив get_return всегда равен нулю, даже если в моих таблицах «articoli» и «giornalisti» есть данные, я публикую ниже метод и основной код для этого
trovaInfo Method I use for connection to my database 'giornalisti':
public ArrayList trovaInfo(String id) {
ArrayList result=new ArrayList();
try {
new com.mysql.jdbc.Driver();
Class.forName("com.mysql.cj.jdbc.Driver");
String url="jdbc:mysql://localhost:3306/giornalisti?autoReconnect=true&useSSL=false";
Connection con=DriverManager.getConnection(url, "root", "root");
Statement cmd=con.createStatement();
String query="SELECT articoli.title, giornalisti.surname FROM articoli JOIN giornalisti ON articoli.id_giornalista="+id+" AND giornalisti.id="+id;
ResultSet res2= cmd.executeQuery(query);
while(res2.next()) {
result.add(new Info(res2.getString("title"), res2.getString("surname")));
}
res2.close();
cmd.close();
con.close();
}
catch(Exception e) {
System.out.println("errore di connessione: "+e);
e.printStackTrace();
}
return result;
}
Code in the main section where I generate the Stub and insert the Id to get my data
GiornalistiStub stub = new GiornalistiStub();
TrovaInfo atn = new TrovaInfo();
System.out.print("Insert journalist id to get the relative article's title:");
String id=in.next();
atn.setId(id);
TrovaInfoResponse res=stub.trovaInfo(atn);
if(res!=null){
System.out.print(res.get_return()[0].getSurname()); //HERE is the error
System.out.println("Here is the title");
for(int i=0;i
Подробнее здесь: [url]https://stackoverflow.com/questions/79366173/my-array-get-return-is-always-null-even-if-i-have-data-in-my-tables-articoli-a[/url]
Мой массив get_return всегда равен нулю, даже если в моих таблицах «articoli» и «giornalisti» есть данные, я публикую ниже метод и основной код для этого [code] trovaInfo Method I use for connection to my database 'giornalisti':
public ArrayList trovaInfo(String id) { ArrayList result=new ArrayList(); try { new com.mysql.jdbc.Driver(); Class.forName("com.mysql.cj.jdbc.Driver"); String url="jdbc:mysql://localhost:3306/giornalisti?autoReconnect=true&useSSL=false"; Connection con=DriverManager.getConnection(url, "root", "root"); Statement cmd=con.createStatement(); String query="SELECT articoli.title, giornalisti.surname FROM articoli JOIN giornalisti ON articoli.id_giornalista="+id+" AND giornalisti.id="+id; ResultSet res2= cmd.executeQuery(query); while(res2.next()) { result.add(new Info(res2.getString("title"), res2.getString("surname"))); } res2.close(); cmd.close(); con.close(); } catch(Exception e) { System.out.println("errore di connessione: "+e); e.printStackTrace(); } return result; } Code in the main section where I generate the Stub and insert the Id to get my data
GiornalistiStub stub = new GiornalistiStub(); TrovaInfo atn = new TrovaInfo(); System.out.print("Insert journalist id to get the relative article's title:"); String id=in.next(); atn.setId(id); TrovaInfoResponse res=stub.trovaInfo(atn);
if(res!=null){ System.out.print(res.get_return()[0].getSurname()); //HERE is the error System.out.println("Here is the title"); for(int i=0;i
Мой массив get_return всегда равен нулю, даже если в моих таблицах «articoli» и «giornalisti» есть данные, я публикую ниже метод и основной код для этого
trovaInfo Method I use for connection to my database 'giornalisti':
Мой массив get_return всегда равен нулю, даже если в моих таблицах «articoli» и «giornalisti» есть данные, я публикую ниже метод и основной код для этого
trovaInfo Method I use for connection to my database 'giornalisti':
Я использую очередь базы данных для отправки электронной почты. Большую часть времени это работает, но иногда электронное письмо не отправляет, но задание успешно завершается. Mail::to('undisclosed_recipients@.....com')->send(new...