Re: [MySQL][Jar] Problems outside the IDE

Your problem is getting the all the classes on the classpath. One thing that makes it harder is having your class in a package. Remove the package statement and you wouldn't have to worry about putting your classes in the correct folder.

Re: [MySQL][Jar] Problems outside the IDE

Re: [MySQL][Jar] Problems outside the IDE

Can't Connect to Database
Exception in thread "main" java.lang.RuntimeException: com.mysql.jdbc.exceptions.MySQLSyntaxErrorExceptio n: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????' at line 1
at ConnectionDataBase.getConnection(ConnectionDataBas e.java:48)
at GenericDao.<init>(GenericDao.java:19)
at DadosDao.<init>(DadosDao.java:17)
at DadosController.listaDados(DadosController.java:65 )
at Principal.<init>(Principal.java:35)
at Cadastro.main(Cadastro.java:12)
Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorExceptio n: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????' at line 1
at com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:1049)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:3597)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:3529)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:19 90)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java :2151)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionIm pl.java:2619)
at com.mysql.jdbc.ConnectionImpl.configureClientChara cterSet(ConnectionImpl.java:1881)
at com.mysql.jdbc.ConnectionImpl.initializePropsFromS erver(ConnectionImpl.java:3496)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(Co nnectionImpl.java:2385)
at com.mysql.jdbc.ConnectionImpl.createNewIO(Connecti onImpl.java:2154)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImp l.java:792)
at com.mysql.jdbc.ConnectionImpl.getInstance(Connecti onImpl.java:377)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:305)
at java.sql.DriverManager.getConnection(libgcj.so.11)
at java.sql.DriverManager.getConnection(libgcj.so.11)
at ConnectionDataBase.getConnection(ConnectionDataBas e.java:26)
...5 more

Re: [MySQL][Jar] Problems outside the IDE

I can't get how it is wrong if it works on the IDE, I've already checked my SQL code (Class DadosDao) and it seens to be right, the problem must be when the code needs to run outside the IDE.... what doesn't make sense for me....

Re: [MySQL][Jar] Problems outside the IDE

Ok, I think I've found my problem.

Outside the IDE I get the message "Can't connect to the database" (that is a SQL Exception)
So I tried to debug everywhere that I had a SQL Exception.
I get all these prints on the IDE (and just them,after connection sucess, 16, 17, 18....).
But outside the IDE, It ends on "Can't connect to the database" and shows the error messages

Re: [MySQL][Jar] Problems outside the IDE

It's not the SQL they're using, look at the stacktrace:
at java.sql.DriverManager.getConnection(libgcj.so.11)
at ConnectionDataBase.getConnection(ConnectionDataBas e.java:26)

That's not an execute...that's trying to get the connection.

Something about the IDE environment and the command line environment is different. And I doubt it's something we here could debug. I would suggest taking this to a MySQL forum maybe? They might know what goes on inside the driver.

Re: [MySQL][Jar] Problems outside the IDE

There you go.
I would lay good odds that it's a mix of the compiling of your Java in a later version (your JDK is 7, your jar file says 6, you're running on 5), and using gnu java and not an Oracle one.