2 Replies Latest reply on Aug 9, 2004 10:12 AM by darranl

    how to configure jboss to use Mysql and LDAP ?

    madadi

      Dear all,

      I want to know what are the configuration files i have to change or add to use Mysql and LDAP with JBOSS.

      Up to now i used JBOSS with Mysql ,but now i want to use LDAP also, is it possible that i can store data in both Mysql and LDAP in same time. i mean can i write a servlets,Ejb's in such a way that i can store data in Mysql and LDAP . i am working on windows and i installed LDAP on windows.

      I need to synchronize between Mysql and LDAP .information and suggestions are needed........

      Regards
      madadi

        • 1. Re: how to configure jboss to use Mysql and LDAP ?
          wmac

          Hello,

          I don't think you need anything else to be able to use LDAP. Pure java supports LDAP (I mean J2SE).

          Again about MySQL you just need to add a MySQL jconnect JDBC driver to your CLASSPATH and load it's driver in your program as you may do in a normal pure command line Java program and use it.

          Synchronize between MySQL and LDAP?

          By the way a sample program:

          import java.sql.*;
          
          public class CreateAgency {
          
           public static void main(String[] args) {
           String driver = "com.mysql.jdbc.Driver";
           String protocol = "jdbc:mysql://localhost:3306/Agency";
          
           try {
          
           try
           {
           Class.forName(driver).newInstance();
           System.out.println("Loaded driver: "+driver);
           }
           catch (Exception e)
           {
           System.out.println("ERROR: load mysql driver failed");
           }
          
          
           Connection conn = DriverManager.getConnection(protocol, "root", "zlogs");
           System.out.println("Connected to: "+protocol);
          
           conn.setAutoCommit(false);
           Statement s = conn.createStatement();
          
           System.out.println("Creating new tables...");
           s.execute("create table Skill(name varchar(16), description varchar(64))");
           conn.commit();
           s.close();
           conn.close();
           System.out.println("Committed transaction and closed connection");
           }
           catch (SQLException ex) {
           System.out.println("SQL Exception thrown: "+ex);
           ex.printStackTrace();
           }
          
          
           // shutdown cloudscape
           // this always throws an exception
          
           try {
           DriverManager.getConnection("jdbc:mysql:;shutdown=true");
           System.out.println("Database did not shut down normally");
           }
           catch (SQLException ex) {
           System.out.println("Database shut down normally");
           }
           } //main ends
          }
          


          Regards,
          Mac
          Programmernet.org

          • 2. Re: how to configure jboss to use Mysql and LDAP ?
            darranl

            Mac,

            The question asked related was how to use LDAP and MySQL with JBoss, not how to use them in a J2SE application.

            The instructions you have given are for J2SE not J2EE.