Using Apache Derby Database with WebLogic (the express way)

this is more a note to myself, because I keep forgetting the details and then I get angry about myself when I am in a hurry 😉

If you quickly require a database with WebLogic 12.1.1 (or some other version 10.3.3 or later, because since then WLS comes with Derby) and some content (e.g. to try some monitoring tool or a WLST script or something), do the following:

– make sure you have the WebLogic samples and the sample DB installed.

– create a new domain.

– in the domain’s under DOMAIN_HOME/bin
change the DERBY_FLAG from false to true.

– start the Admin server which will start the Derby database as well.

– Create a data source using the following values:

 DBName: medrec
 Host: localhost
 Port: 1527
 Username: medrec
 Password: medrec

– Test the connection pool after creating it. It should work right away.




more details, recipes and discussions …


  1. Frank:

    I am an unemployed software engineer and so I acquired 5 Java Certifications.
    So, that’s my background.
    Back in 2010, I did create a site using NetBeans and GlassFish Server.
    However, that website it doesn’t have a domain name…
    it just runs on an old PC when I turn it on for folks to look at.
    ( unless you want to recommend a low cost GlassFish hosing site… it has no database.

    Anyways, I’ve been away from Java because of some other distractions and now need to catch up.
    Now, obviously, I see your post here, ,
    but the perception I get from reading the WebLogic Server 12.1.2 documentation is that the RCU utility needs
    to be run and requires a database before you even start WebLogic Server.

    I am so dam confused… it shouldn’t be this way. I’m a smart guy and follows directions.
    Not sure what, but something terrible ( okay, not that bad ) has gone wrong.
    Could you take a look at this post…

    I do have your “Distinctive Recipes” book.
    Heck, I’ve got 5 Banker Boxes filled with JSE, JME, JEE and Oracle books.
    I can’t believe I’m the only one confused.
    Can you please help demystify my forum post, please.

    I don’t think the documentation says anything at all about Java DB except that Yes, it is supported.
    I didn’t read anything about Java DB being built in nor how to use it with RCU.
    I guess it depends on what one’s definition is ” Support ” is.

    I did configure JDK1.7.0_u40’s Java DB, but I can’t get the RCU to talk to Java DB.
    No mention anywhere in the RCU doc (I don’t think) whether RCU talks with
    SSL=off or SSL=basic. or SSL=LDAP.
    I think we have a need to know !


    • Michael,

      WebLogic works without any DB at all.
      My posting shows a quick way to get a simple DB (containing some data already) started with WebLogic 12.1.1

      SOA Suite and other OFM products on the other hand require a repo which is set up with the RCU. For this you can only use supported DBs, have a look here:
      Java DB is only supported for application data, not the RCU. Oracle XE will work for this and you can get it for free, although not supported in production. For ADF you better talk to the GUI people.

      thanks for your question!

  2. Michael says


    > WebLogic works without any DB at all.

    The “Installing and Configuring” document Section 3.1 says
    ” Before you can configure a Fusion Middleware Infrastructure domain, you must install the following schemas “.



    • Michael,

      there is a difference between WebLogic and OFM.
      WebLogic certainly does work without any DB at all. I have done that hundreds of times during the last 15 years.

      Also parts of OFM, e.g. OSB 11g could work without DB (when neither using report nor OWSM).
      Most parts of OFM require the MDR though.

      thanks for bringing this up!


  3. Michael says

    Frank :

    The youtube video above edits which is for Unix / Linux.

    For the Windows operating system, setDomainEnv.cmd was not mentioned and so
    the implication is that creating a JDBC data source for Derby should work on windows.
    However, when I click the “Test Configuration” button, exceptions occur ( and it is
    difficult to associate the exceptions with a root cause ).

    The WebLogic Server is actually ADF Essentials,

    From the download tab, the “Application Development Runtime” was downloaded and installed.
    Then a domain was created for a Standalone Admin Server in Development Mode.

    The database was set up, correctly.
    ij> was used to verify that tables owned by the user can be queried.

    When I “startweblogic”, a smaller command prompt window appears momentarily and
    is entitled ” Derby Server For WLS Examples Server ” and then rather quickly disappears.

    Next, I followed this…
    ” How to set up Apache Derby JDBC data source in Oracle WebLogic application server ”
    As mentioned earlier, when I click the “Test Configuration” button, exceptions occur.

    When I “stopweblogic”, the last two lines in the (first) command prompt window are…
    ” Stopping Derby server…
    Derby server stopped ”

    Any thoughts ?


  4. Michael says


    When I said “The database was set up, correctly”,
    I meant that I tested the setup using Derby’s ij> and connected using the EMBEDDED DRIVER.

    However, I did NOT test the setup using Derby’s ij> and connect using the CLIENT DRIVER.
    This test is failing.
    I’m looking on this now.

  5. Michael says

    Frank :

    I had a files and deleted it.
    Now both the Embedded Driver and Client Driver are working.

    Derby’s ij> connect using the Embedded driver…
    CONNECT ‘jdbc:derby://localhost:1527/C:\Derby\PopeyeDB’;

    Derby’s ij> connect using the Client driver…
    ij> CONNECT ‘jdbc:derby://localhost:1527/C:\Derby\PopeyeDB;user=sa;password=derby’;
    ij> select * from collections;
    lmsmv |Lake Michigan Salmon Music Videos
    popeye |Popeye Cartoons
    porthole |Things You See Out Of A Porthole
    commercial |Advertisements / Commercials
    java |Java Programming Music Videos
    aquarium |Largest Aquariums in the World
    sockeye |Sockeye Salmon
    perch |Perch Videos
    fly |Fish Fly Tying Videos
    9 rows selected

    Do we need a special file to satisfy WebLogic Data Sources ?

    Here is the stack trace…

    <Administration Console encountered the following error: java.sql.SQLNonTransientConnectionException:
    on : Error connecting to server localhost on port 1527 with message Connection refused: connect.
    at Source)
    at Source)
    at org.apache.derby.client.ClientPooledConnection.(Unknown Source)
    at org.apache.derby.client.ClientXAConnection.(Unknown Source)
    at org.apache.derby.client.ClientXAConnection40.(Unknown Source)
    at Source)
    at org.apache.derby.jdbc.ClientXADataSource.getXAConnectionX(Unknown Source)
    at org.apache.derby.jdbc.ClientXADataSource.getXAConnection(Unknown Source)
    at weblogic.jdbc.common.internal.DataSourceUtil.testConnection0(
    at weblogic.jdbc.common.internal.DataSourceUtil.access$000(
    at weblogic.jdbc.common.internal.DataSourceUtil$
    at Method)
    at weblogic.jdbc.common.internal.DataSourceUtil.testConnection(
    at com.bea.console.utils.jdbc.JDBCUtils.testConnection(
    at com.bea.console.actions.jdbc.datasources.createjdbcdatasource.CreateJDBCDataSource.testConnectionConfiguration(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(
    at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(
    at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(


  6. Michael says

    Wondering if WebLogic failed to start the Derby Server,
    I opened a Command Prompt window and…
    c:\Derby>java -jar %DERBY_HOME%\lib\derbyrun.jar server start
    Fri May 02 18:59:45 CDT 2014 : Security manager installed using the Basic server security policy.
    Fri May 02 18:59:46 CDT 2014 : Apache Derby Network Server – – (1557835) started and ready to accept connections on port 1527

    This (above response ) implies the Derby Server was not running.

    If the Derby Server was running as it is now and
    then I try to start it, I do see this…
    c:\Derby>java -jar %DERBY_HOME%\lib\derbyrun.jar server start
    Fri May 02 19:10:33 CDT 2014 : Security manager installed using the Basic server security policy.
    Fri May 02 19:10:33 CDT 2014 : Could not listen on port 1527 on host localhost: Address already in use: JVM_Bind

    Notice that now the last line says ” Address already in use “.

    Next, I stopped weblogic and shutdown Derby and
    then started the Derby Server (first) and then started WebLogic.
    Creating the Data Source succeeded… ” Message icon – Success Connection test succeeded. “.

    Not sure if WebLogic is supposed to start the Derby Server or
    if the Administrator / Deployer is supposed to start the Derby Server.

    Let’s take another look at the procedure I was following…
    ” How to set up Apache Derby JDBC data source in Oracle WebLogic application server ”
    Yup, the very first subsection is entitled ” Starting the database server ”
    ( and uses startNetworkServer ).

    Certainly, I skipped ” Starting the database server ” and
    startWebLogic’s pop-up window entitled ” Derby Server For WLS Examples Server ”
    gave me the impression WebLogic was starting the Derby Server.
    Likewise, stopWebLogic’s outputs ” Stopping Derby server… Derby server stopped “.
    In addition, the video, , also does not
    start the Derby Server.

    Well, those are my observations.
    Conclusion: On Windows, it seems Starting The Derby Server is required first (before) starting WebLogic Server.

    NOTE: I’m actually working with ADF Essentials / “Application Development Runtime” [ v 12.1.2 ],
    as mentioned earlier.

  7. Good Article!

Speak Your Mind