Salve ragazzi, scusate per il titolo, ma non sapevo davvero come riassumere tutto in poche parole... c'ho pensato dopo a cosa scrivere e l'ho messo nel soggetto.. pardòn.
Il fatto è che ho un progetto Struts che su una macchina (PC) va, mentre su un'altra (Mac) no.
Vi spiego il problema, che sta tutto nella creazione del PreparedStatement all'interno di una Action di registrazione utente al sito.
Sulla macchina PC non da problemi, e l'utente viene registrato al db senza problemi. Sul Mac restituisce invece una SQLException.
Non capendo, ho inserito, dopo la preparazione dello Statement, dei log dopo ogni setString, in modo tale da capire dove fosse esattamente il problema.
Questo è il risultato:
Come vedete, il PreparedStatement non ha problemi, perchè ad ogni setString il valore viene sostituito correttamente. E' la parentesi tonda di chiusura a dare problemi, poichè viene trasformata in un.. indirizzo di memoria? Inoltre non viene registrato l'indirizzo di memoria del PreparedStatement, mentre viene visualizzata quella parentesi quadra sospetta.Codice PHP:INFO UserDAO - >> com.mysql.jdbc.ServerPreparedStatement[1] - INSERT INTO users (firstName, lastName, email, username, password, question, answer) VALUES ('Angelina', ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **[B@1bbe4f
INFO UserDAO - >> com.mysql.jdbc.ServerPreparedStatement[1] - INSERT INTO users (firstName, lastName, email, username, password, question, answer) VALUES ('Angelina', 'Jolie', ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **[B@ad8678
INFO UserDAO - >> com.mysql.jdbc.ServerPreparedStatement[1] - INSERT INTO users (firstName, lastName, email, username, password, question, answer) VALUES ('Angelina', 'Jolie', 'angelina.jolie@pitt.com', ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **[B@a238e
INFO UserDAO - >> com.mysql.jdbc.ServerPreparedStatement[1] - INSERT INTO users (firstName, lastName, email, username, password, question, answer) VALUES ('Angelina', 'Jolie', 'angelina.jolie@pitt.com', 'angelina', ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **[B@3a4ad0
INFO UserDAO - >> com.mysql.jdbc.ServerPreparedStatement[1] - INSERT INTO users (firstName, lastName, email, username, password, question, answer) VALUES ('Angelina', 'Jolie', 'angelina.jolie@pitt.com', 'angelina', 'fastandfurios', ** NOT SPECIFIED **, ** NOT SPECIFIED **[B@62ca06
INFO UserDAO - >> com.mysql.jdbc.ServerPreparedStatement[1] - INSERT INTO users (firstName, lastName, email, username, password, question, answer) VALUES ('Angelina', 'Jolie', 'angelina.jolie@pitt.com', 'angelina', 'fastandfurios', 'How many children I have?', ** NOT SPECIFIED **[B@63542c
INFO UserDAO - >> com.mysql.jdbc.ServerPreparedStatement[1] - INSERT INTO users (firstName, lastName, email, username, password, question, answer) VALUES ('Angelina', 'Jolie', 'angelina.jolie@pitt.com', 'angelina', 'fastandfurios', 'How many children I have?', 'A lot.'[B@e8ac6f
Non capisco. Ripeto: sul PC non vengono restituiti problemi di alcun tipo. Ho aggiornato il server, rideployato, cleaned, build, riscritto il codice, ma nulla.
Questo è il log che viene restituito sul pc, corretto (i dati sono diversi):
Il codice SQL è:Codice PHP:INFO UserDAO - >> com.mysql.jdbc.JDBC4PreparedStatement@1226a77: INSERT INTO users (firstName, lastName, email, username, password, question, answer) VALUES ('Franco', ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **)
INFO UserDAO - >> com.mysql.jdbc.JDBC4PreparedStatement@1226a77: INSERT INTO users (firstName, lastName, email, username, password, question, answer) VALUES ('Franco', 'Franchi', ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **)
INFO UserDAO - >> com.mysql.jdbc.JDBC4PreparedStatement@1226a77: INSERT INTO users (firstName, lastName, email, username, password, question, answer) VALUES ('Franco', 'Franchi', 'ciccio@rai.it', ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **)
INFO UserDAO - >> com.mysql.jdbc.JDBC4PreparedStatement@1226a77: INSERT INTO users (firstName, lastName, email, username, password, question, answer) VALUES ('Franco', 'Franchi', 'ciccio@rai.it', 'ciccio', ** NOT SPECIFIED **, ** NOT SPECIFIED **, ** NOT SPECIFIED **)
INFO UserDAO - >> com.mysql.jdbc.JDBC4PreparedStatement@1226a77: INSERT INTO users (firstName, lastName, email, username, password, question, answer) VALUES ('Franco', 'Franchi', 'ciccio@rai.it', 'ciccio', 'ciccio', ** NOT SPECIFIED **, ** NOT SPECIFIED **)
INFO UserDAO - >> com.mysql.jdbc.JDBC4PreparedStatement@1226a77: INSERT INTO users (firstName, lastName, email, username, password, question, answer) VALUES ('Franco', 'Franchi', 'ciccio@rai.it', 'ciccio', 'ciccio', 'chi sono?', ** NOT SPECIFIED **)
INFO UserDAO - >> com.mysql.jdbc.JDBC4PreparedStatement@1226a77: INSERT INTO users (firstName, lastName, email, username, password, question, answer) VALUES ('Franco', 'Franchi', 'ciccio@rai.it', 'ciccio', 'ciccio', 'chi sono?', 'franco')
Il DB è un semplice db di test a una tabella, identico sulle due macchine in tutto e per tutto (sul PC uso Wamp, sul Mac invece Mamp).Codice PHP:"INSERT INTO users (firstName, lastName, email, username, password, question, answer) VALUES (?, ?, ?, ?, ?, ?, ?)";
Anche l'IDE è uguale: MyEclipse.
Qualche idea geniale? GRAZIE!
ps. Il problema è insorto quando ho aggiunto due dati (question e answer) all'applicazione di registrazione. Ho modificato di conseguenza tutto il progetto e da quel momento sul Mac ha smesso di andare. Poi però ho COPIATO il db, così come era, sul PC e COPIATO il progetto, così come era... e sul PC va. Non capirò mai... senza il vostro aiuto![]()

Rispondi quotando