This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I written one JDBC connection class. While running it's showing Exception. i am using netbeans6.1 and jboss4.0.4 server. i added the driver also that is my-connector-java-5.1.
please help me to solve this problem
Exception are
init: deps-module-jar: deps-ear-jar: deps-jar: compile-single: run-main: com.mysql.jdbc.CommunicationsException: Communications link failure
Last packet sent to the server was 0 ms ago. at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1070) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2103) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:718) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:298) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282) at java.sql.DriverManager.getConnection(DriverManager.java:525) at java.sql.DriverManager.getConnection(DriverManager.java:171) at com.myapp.struts.Database.getConnection(Database.java:25) at com.myapp.struts.Database.main(Database.java:36) got connection Caused by: java.net.UnknownHostException: mysql.local.com: mysql.local.com at java.net.InetAddress.getAllByName0(InetAddress.java:1128) at java.net.InetAddress.getAllByName0(InetAddress.java:1098) at java.net.InetAddress.getAllByName(InetAddress.java:1061) at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:243) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:280) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2026) ... 7 more java.lang.NullPointerException at com.myapp.struts.Database.main(Database.java:38) BUILD SUCCESSFUL (total time: 20 seconds)
What is the name of the host running MySQL? Change the database URL to use that host name (instead of "mysql.local.com"). If the MySQL database is running on the same host as your code, then use: