db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel A Keefe <dan.ke...@convergys.com>
Subject RE: problem with embedded driver
Date Wed, 20 Apr 2011 11:47:12 GMT
I have found that I need to include the path to the derby db in my connect string


From: steve lescure [stevelescure@yahoo.com]
Sent: Tuesday, April 19, 2011 10:36 PM
To: Derby Discussion
Subject: Re: problem with embedded driver

thanks that was a great big help!   never would have figured all that out.

i can now connect to the database............now i've encounter yet another mystery.

It keeps telling me it can't find my table JOBS....i've read that NETBEANS should create 
a default schema NBUSER (the id I used to when i created the db).  When i check the properties
of the database, the schema is indeed NBUSER.  however, to create a table i have to use the
APP schema (NBUSER is not in the list).  I did that, but NETBEANS can't find the table even
if i use APP.JOBS... I've tried JOBS  APP.JOBS NBUSER.JOBS all fail.

any thoughts?

        try {
            Properties props = new Properties(); // connection properties
            props.put("user", "nbuser");
            props.put("password", "nbuser");
            String dbName = "DEMAND"; // the name of the database

            conn = DriverManager.getConnection(protocol + dbName
                    + ";create=false", props);
            System.out.println("Connected to database " + dbName);

            s = conn.createStatement();
            rs = s.executeQuery(
                    "SELECT JOBNAME, USERID FROM APP.JOBS");
            (dies here)

--- On Tue, 4/19/11, Mark Eggers <mdeggers@gmail.com> wrote:

> From: Mark Eggers <mdeggers@gmail.com>
> Subject: Re: problem with embedded driver
> To: derby-user@db.apache.org
> Date: Tuesday, April 19, 2011, 4:46 PM
> On Tue, 19 Apr 2011 12:45:54 -0700,
> steve lescure wrote:
> > String dbName = "//localhost:1527/users";
> This is a connection to the network server. If you don't
> start the
> database prior to running your program, there will be no
> connection.
> If you're using the embedded driver, the database name is
> just the name
> of the database (users, in your case).
> Now the next problem is that with NetBeans, the database
> gets created in
> a strange spot - $HOME/.netbeans-derby by default. Probably
> the easiest
> way to run this program is by passing a value for the
> derby.system.home
> property. This tells Derby where to look for databases when
> the program
> is started.
> By default, the value is ".". This obviously won't work for
> your code,
> since you used NetBeans to create the database. However,
> setting this in
> NetBeans is pretty easy.
> 1. Right-mouse click on your project and select Properties
> 2. In the dialog box, click on the Run item
> 3. Add the following to your VM Options:
> -Dderby.system.home=$HOME/.netbeans-derby
> You might have to replace $HOME with the full path,
> depending on how
> NetBeans handles environment variables.
> Now the program will run from within NetBeans. When you run
> this from the
> command line (in the dist folder of your project), use the
> following
> syntax.
> java -Dderby.system.home=$HOME/.netbeans-derby -jar
> YourApp.jar
> Hope this helps.
> . . . . just my two cents.
> /mde/

NOTICE:  The information contained in this electronic mail transmission is intended by Convergys
Corporation for the use of the named individual or entity to which it is directed and may
contain information that is privileged or otherwise confidential.  If you have received this
electronic mail transmission in error, please delete it from your system without copying or
forwarding it, and notify the sender of the error by reply email or by telephone (collect),
so that the sender's address records can be corrected.

View raw message