PattyPJ 11 de ago. de 2005
Coloca um trecho do código, se possível…
Imagino que vc esteja tentando inicializar uma variável de forma incorreta… Talvez uma variável não estática da classe dentro de um método estático… Mas explica melhor o contexto e o problema, senão não dá pra ajudar…
Abs
GraveDiggerPJ 11 de ago. de 2005
Olha q elucidativo :roll:
General error
java . sql . SQLException & # 58 ; General error
at sun . jdbc . odbc . JdbcOdbc . createSQLException & # 40 ; Unknown Source & # 41 ;
at sun . jdbc . odbc . JdbcOdbc . standardError & # 40 ; Unknown Source & # 41 ;
at sun . jdbc . odbc . JdbcOdbc . SQLExecute & # 40 ; Unknown Source & # 41 ;
at sun . jdbc . odbc . JdbcOdbcPreparedStatement . execute & # 40 ; Unknown Source & # 41 ;
at sun . jdbc . odbc . JdbcOdbcPreparedStatement . executeUpdate & # 40 ; Unknown Source & # 41 ;
at Ocorrencias . DataAccess . novoContato & # 40 ; DataAccess . java & # 58 ; 312 & # 41 ;
at Ocorrencias . Principal$SaveAction . actionPerformed & # 40 ; Principal . java & # 58 ; 316 & # 41 ;
at javax . swing . AbstractButton . fireActionPerformed & # 40 ; Unknown Source & # 41 ;
at javax . swing . AbstractButton$Handler . actionPerformed & # 40 ; Unknown Source & # 41 ;
at javax . swing . DefaultButtonModel . fireActionPerformed & # 40 ; Unknown Source & # 41 ;
at javax . swing . DefaultButtonModel . setPressed & # 40 ; Unknown Source & # 41 ;
at javax . swing . plaf . basic . BasicButtonListener . mouseReleased & # 40 ; Unknown Source & # 41 ;
at java . awt . AWTEventMulticaster . mouseReleased & # 40 ; Unknown Source & # 41 ;
at java . awt . Component . processMouseEvent & # 40 ; Unknown Source & # 41 ;
at javax . swing . JComponent . processMouseEvent & # 40 ; Unknown Source & # 41 ;
at java . awt . Component . processEvent & # 40 ; Unknown Source & # 41 ;
at java . awt . Container . processEvent & # 40 ; Unknown Source & # 41 ;
at java . awt . Component . dispatchEventImpl & # 40 ; Unknown Source & # 41 ;
at java . awt . Container . dispatchEventImpl & # 40 ; Unknown Source & # 41 ;
at java . awt . Component . dispatchEvent & # 40 ; Unknown Source & # 41 ;
at java . awt . LightweightDispatcher . retargetMouseEvent & # 40 ; Unknown Source & # 41 ;
at java . awt . LightweightDispatcher . processMouseEvent & # 40 ; Unknown Source & # 41 ;
at java . awt . LightweightDispatcher . dispatchEvent & # 40 ; Unknown Source & # 41 ;
at java . awt . Container . dispatchEventImpl & # 40 ; Unknown Source & # 41 ;
at java . awt . Window . dispatchEventImpl & # 40 ; Unknown Source & # 41 ;
at java . awt . Component . dispatchEvent & # 40 ; Unknown Source & # 41 ;
at java . awt . EventQueue . dispatchEvent & # 40 ; Unknown Source & # 41 ;
at java . awt . EventDispatchThread . pumpOneEventForHierarchy & # 40 ; Unknown Source & # 41 ;
at java . awt . EventDispatchThread . pumpEventsForHierarchy & # 40 ; Unknown Source & # 41 ;
at java . awt . EventDispatchThread . pumpEvents & # 40 ; Unknown Source & # 41 ;
at java . awt . EventDispatchThread . pumpEvents & # 40 ; Unknown Source & # 41 ;
at java . awt . EventDispatchThread . run & # 40 ; Unknown Source & # 41 ;
“General error”.
Ajuda mto na hora de debugar…
método para inserir os cadastros, onde está dando SQLException
public boolean novoContato & # 40 ; Contato person , Ocorrencia ocor & # 41 ;
throws DataAccessException
& # 123 ;
try & # 123 ;
int result ;
String temp = person . getNome & # 40 ; & # 41 ;;
StringTokenizer tokens = new StringTokenizer & # 40 ; temp & # 41 ;;
String nome = "" ;
while & # 40 ; tokens . hasMoreTokens & # 40 ; & # 41 ; & # 41 ;
nome += tokens . nextToken & # 40 ; & # 41 ;;
sqlInsertContato . setString & # 40 ; 1 , nome & # 41 ;;
sqlInsertContato . setString & # 40 ; 2 , person . getMail & # 40 ; & # 41 ; & # 41 ;;
sqlInsertContato . setString & # 40 ; 3 , person . getExtraMails & # 40 ; & # 41 ; & # 41 ;;
sqlInsertContato . setString & # 40 ; 4 , person . getTelRes & # 40 ; & # 41 ; & # 41 ;;
sqlInsertContato . setString & # 40 ; 5 , person . getTelCom & # 40 ; & # 41 ; & # 41 ;;
sqlInsertContato . setString & # 40 ; 6 , person . getTelCel & # 40 ; & # 41 ; & # 41 ;;
sqlInsertContato . setString & # 40 ; 7 , person . getFax & # 40 ; & # 41 ; & # 41 ;;
sqlInsertContato . setString & # 40 ; 8 , person . getExtraTels & # 40 ; & # 41 ; & # 41 ;;
sqlInsertContato . setInt & # 40 ; 9 , person . getId & # 40 ; & # 41 ; & # 41 ;;
result = sqlInsertContato . executeUpdate & # 40 ; & # 41 ;;
if & # 40 ; result == 0 & # 41 ; & # 123 ;
connection . rollback & # 40 ; & # 41 ;;
return false ;
& # 125 ;
sqlInsertOcorrencia . setString & # 40 ; 1 , ocor . getOcorrencia & # 40 ; & # 41 ; & # 41 ;;
sqlInsertOcorrencia . setInt & # 40 ; 2 , person . getId & # 40 ; & # 41 ; & # 41 ;;
sqlInsertOcorrencia . setDate & # 40 ; 3 , ocor . getData & # 40 ; & # 41 ; & # 41 ;;
result = sqlInsertOcorrencia . executeUpdate & # 40 ; & # 41 ;;
if & # 40 ; result == 0 & # 41 ; & # 123 ;
connection . rollback & # 40 ; & # 41 ;;
return false ;
& # 125 ;
connection . commit & # 40 ; & # 41 ;;
return true ;
& # 125 ;
catch & # 40 ; SQLException sqle & # 41 ; & # 123 ;
System . err . println & # 40 ; sqle . getMessage & # 40 ; & # 41 ; & # 41 ;;
sqle . printStackTrace & # 40 ; & # 41 ;;
& # 125 ;
return false ;
& # 125 ;