I am trying to get a connection to mySQL. I have installed JBoss 3.0.6 w/Tomcat 4.1 and mySQL 3.23.
I am new to appservers and really don't know how to set up the connection. I have tried reading the readme file from mysql, tutorials from apache etc, but it does not seem to work.
JBoss/Tomcat are installed in a directory called jboss_tomcat, and mySQL in a directory called mysql. The JDK used is version 1.4. I have put the mysql-connector-java-2.0.14-bin.jar file in the jre/lib/ext directory of the jdk used, in tomcat/server/lib and in the web-inf directory on the webapp/root dir (where my jsp is) in tomcat, nothing seem to help.
I try to start up tomcat and then I make a jsp which (tries to) connect to a database named nbdtest, with table user. The following is my connection code:
java.sql.Connection conn;
java.sql.Statement stmt = null;
java.sql.ResultSet rs = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/nbdtest");
I would be very happy if someone could help me with this problem.
Now it works. I run tomcat alone though. Does someone have any idea why it works with tomcat alone and not if i start jboss (all)? It seems like tomcat isn't starting properly when I start JBoss.
Where should the mysql-connector-java.jar be placed?