Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Help with setup db in JUnit tests.

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with setup db in JUnit tests.

    First I was using this way how to get connection and all was fine.

    con = DriverManager.getConnection("jdbc:derby:memory:datab;create=true");

    But now I have to change it to DataSource and how I find out derby had class ClientDataSource for this but for the hell I can't find out how to setup that virtual DB.

    ClientDataSource ds = new ClientDataSource();
    con = ds.getConnection();
    Last edited by Slapy; March 26th, 2014 at 07:49 PM. Reason: spelling


  2. #2
    Junior Member
    Join Date
    Nov 2013
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help with setup db in JUnit tests.

    I find out that this

    ClientDataSource ds = new ClientDataSource();
    ds.setDatabaseName("testDB;create=true");
    con = ds.getConnection();

    is working.

Similar Threads

  1. Java Tip Jan 22, 2011 - Primality Tests
    By helloworld922 in forum Java Programming Tutorials
    Replies: 3
    Last Post: November 12th, 2017, 02:49 AM
  2. Free SCJP 1.5/1.6 practice tests
    By devaka in forum The Cafe
    Replies: 1
    Last Post: August 1st, 2013, 02:02 PM
  3. Simple Employee Class Not Passing Tests
    By floorplay in forum What's Wrong With My Code?
    Replies: 4
    Last Post: March 20th, 2013, 05:10 AM
  4. Array that tests if any elements repeat themselves
    By jean28 in forum What's Wrong With My Code?
    Replies: 8
    Last Post: February 10th, 2013, 12:45 AM
  5. Java Tip Jan 22, 2011 - Primality Tests
    By helloworld922 in forum Java Code Snippets and Tutorials
    Replies: 2
    Last Post: April 18th, 2011, 08:16 PM