0 Replies Latest reply on Jul 31, 2003 7:36 AM by domn

    JBOSS 3.2.1 & Tomcat 4.1.24 with MSSQL 2000

    domn

      hi everyone

      i'm a jboss noob
      recently i've been going thru a lot of forums, looking for useful information about setting up my developement environment on win2k

      now when everything seems to work i have decided to share my knowledge :)

      so, here it is:

      JAVA2SE:
      - download SDK from http://java.sun.com/j2se/1.4/download.html
      - run installation program
      - put \bin subdirectory in the PATH environment variable
      - set the environment variable JAVA_HOME to your java installation directory
      - to test if everything is in order, go to command prompt and execute "java -version"

      JAVA2EE:
      - run installation program
      - put \bin subdirectory in the PATH environment variable
      - set the environment variable J2EE_HOME to your j2ee installation directory

      JBOSS 3.2.1 & Tomcat 4.1.24:
      - unzip the archive into a directory
      - set the environment variable JBOSS_HOME to point to the base directory of the unzipped distribution
      - open file server\default\deploy\jbossweb-tomcat.sar\META-INF\jboss-service.xml
      - change the port number from 8080 to 80
      - insert reloadable="true" in the subelement
      - open file server\default\conf\jboss-service.xml
      - add your web files directory after deploy/ and a coma (,)
      - for further use you may want to add the following files to the CLASSPATH environment variable:
      - 'JBOSS_HOME'\server\default\lib\javax.servlet.jar , where 'JBOSS_HOME' is the JBoss base directory
      - 'JBOSS_HOME'\server\default\lib\jboss-j2ee.jar
      - to start server execute "bin\run.bat"

      INTEGRATION of MSSQL 2000 with JBoss:
      - install the JDBC driver (you can get it from microsoft for free)
      - go to the \lib subdirectory of the JDBC driver installation directory; there you will find msbase.jar, mssqlserver.jar and msutil.jar
      - copy them to the \server\default\lib subdirectory of JBoss
      - remove (or just rename to .bak) \server\default\deploy\hsqldb-service.xml file in JBoss to prevent JBoss from starting the Hypersonic database
      - go to \docs\examples\jca and copy mssql-ds.xml to \server\default\deploy directory
      - open the file and modify:
      - change the ConnectionURL to point at your sql server and change you database name
      - change the username and password for connecting to the database
      - restart JBoss
      - start Enterprise Manager for MSSQL 2000
      - select your server
      - go to Properties / Security
      - make sure that Authentication is not Windows only


      and now a part of my sample jsp page which uses the sql server:

      String tmp=null;
      Connection myConn=null;
      Statement stmt=null;
      ResultSet resultSet=null;
      try
      {
      Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
      myConn = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=bafmt;SelectMethod=cursor","bafmt","bafmt03");
      stmt = myConn.createStatement();
      resultSet = stmt.executeQuery("select * from ba");

      while(resultSet.next())
      {
      tmp = String.valueOf(resultSet.getInt("id")); out.println(tmp);
      tmp = resultSet.getString("name").toString(); out.println(tmp);
      tmp = resultSet.getString("info").toString(); out.println(tmp);
      out.println("");
      }
      }
      catch(Exception e) { out.println(e.getMessage()); }


      i know it's not much, but maybe it will help someone
      and that's enough

      ------------------

      "It's clearly a budget. It's got a lot of numbers in it."
      - George W. Bush