Java tips & tricks
Exception while connecting from within mod_jk to mysqlDuring the connection fase the following exception is raised:
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: 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 1This can be solved by adding "useJvmCharsetConverters=true" to the connection-string.
String url="jdbc:mysql://192.168.10.31:3306/nummerplan?user=test&password=test&useJvmCharsetConverters=true"; Connection con = DriverManager.getConnection(url);
After creating about 1200 threads, a "java.lang.OutOfMemoryError: unable to create new native thread" exception is thrownThis exception is then thrown regardless of the '-Xmx...MB' setting.
It looks as if this is OpenJDK related: in my own tests I found I could not create more than 1200 threads, even with the -Xmx1024MB setting when using OpenJDK (OpenJDK Runtime Environment (IcedTea6 1.6) (suse-0.1.3-x86_64)). When using the SUN JVM (Java(TM) SE Runtime Environment (build 1.6.0_16-b01)), creating 6000+ threads ran fine!
Using 'Graphics' object on a headless systemRun your Java program with -Djava.awt.headless=true.
Programs take very long to startThis might be related to Java doing things with IPv6. Strace (or truss) well let you know for sure. If that's the case, add -Djava.net.preferIPv4Stack=true to the Java-commandline.
Applet not displayed in browser on MacOSThis is caused by an incompatible JRE version in the browser.
Try upgrading to snow leopard or try compiling your applet with:
javac -source 1.4 -target 1.4 MyApplet.javaThis won't work when you used 1.5 features like enums.
SpeedDo not use Math.pow(x, 2.0), use x * x instead. The second one is 10 times faster (JVM version 1.6.0_13 on an Intel Q9450).
|e-mail me at: firstname.lastname@example.org||support this website|