3 Replies Latest reply on Aug 21, 2002 11:21 AM by David Jencks

    How I can get JDBC_URL and jdbc.driver?

    Dzidas Newbie

      I have JBoss 3.0.0 and postgres database.
      How I can get JDBC_URL and jdbc.driver?
      I tray with this code:
      public static final String JDBC_URL = "connection-url";
      public Connection getConnection() throws SQLException
      String jdbcURL =(String) env.get(JDBC_URL);
      System.out.println(jdbcURL );
      String drivers =(String)env.get("jdbc.drivers");
      return DriverManager.getConnection(jdbcURL, env);
      catch(SQLException ee)
      return null;
      But I get errors, when I use env.get()....
      Maybe somebody can send sample.

        • 1. Re: How I can get JDBC_URL and jdbc.driver?
          David Jencks Master

          Please use a connection pool. FInd postgres-service.xml in docs/examples/jca (or nearby), change it to match your configuration, and put it in server/default/deploy.

          When you need a connection,
          DataSource ds = (DataSource)new InitialContext.lookup("java:/PostgresDS");
          Connection c = ds.getConnection();
          try {
          //do work

          • 2. Re: How I can get JDBC_URL and jdbc.driver?
            Dzidas Newbie

            Thanks for reply.
            Now I persuade, what my postgres-service.xml is not good.
            If I have postgres-ds.xml, then I will get this warrining:

            18:59:32,655 INFO [MainDeployer] Starting deployment of package: file:/C:/bean2
            18:59:32,675 INFO [MainDeployer] Deployment of package: file:/C:/bean2/jboss/se
            rver/default/deploy/postgres-ds.xml is waiting for an appropriate deployer.

            Later, when client is runing:
            19:00:38,920 INFO [STDOUT]javax.naming.NameNotFoundException: PostgresD
            S not boundend
            My postgres-ds.xml:
            <?xml version="1.0" encoding="UTF-8" ?>

            - <local-tx-datasource>

            If I load this postgres-service.xml:

            <?xml version="1.0" encoding="UTF-8"?>

            <!-- ==================================================================== -->
            <!-- New ConnectionManager setup for default postgres dbs -->
            <!-- ==================================================================== -->

            <!--make the rar deploy! hack till better deployment-->

            <depends optional-attribute-name="ManagedConnectionFactoryName">
            <!--embedded mbean-->

            <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=Minerva JDBC LocalTransaction ResourceAdapter

            <!--real attributes-->



            <depends optional-attribute-name="ManagedConnectionPool">
            <!--embedded mbean-->

            <!--criteria indicates if Subject (from security domain) or app supplied
            parameters (such as from getConnection(user, pw)) are used to distinguish
            connections in the pool. Choices are
            ByContainerAndApplication (use both),
            ByContainer (use Subject),
            ByApplication (use app supplied params only),
            ByNothing (all connections are equivalent, usually if adapter supports

            <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager

            I will get this warrning:
            19:04:54,788 INFO [MainDeployer] Starting deployment of package: file:/C:/bean2
            19:04:55,609 WARN [LocalTxConnectionManager] WARNING: UPDATE YOUR SecurityDomai
            nJndiName! REMOVE java:/jaas/
            19:04:55,839 WARN [ServiceController] jboss.jca:service=LocalTxDS,name=Postgres
            DS does not implement any Service methods
            19:04:55,849 INFO [JBossManagedConnectionPool] Creating
            19:04:55,869 INFO [JBossManagedConnectionPool] Created
            19:04:55,869 INFO [JBossManagedConnectionPool] Starting
            19:04:55,879 INFO [JBossManagedConnectionPool] Started
            19:04:55,879 INFO [MainDeployer] Successfully completed deployment of package:

            And when I run client I get errors:
            19:06:24,587 INFO [STDOUT] javax.naming.NameNotFoundException: PostgresD
            S not boundend

            Where I can find step by step config, to make good conection to database?
            I buy JBOSS 3.0 ADMINISTRATION AND DEVELOPMENT DOCUMENTATION, but did not find property information...

            • 3. Re: How I can get JDBC_URL and jdbc.driver?
              David Jencks Master

              *-ds.xml files only work with jboss 3.2 and 4.

              Please use a *-service.xml file that came with your binary download or has a cvs tag for the jboss version you have. Your postgres-service.xml file looks like it is from 3.0RC1 or so. In particular it is using a jca jdbc wrapper that was removed around april.