Re: Unexplained problem

2016-11-23 Thread Donald McLean
I'm starting the Derby server by spawning a process from a test (see
below), so I can't imagine how two copies could be getting started in this
way.

I monitored the test while it was running and found only three java
processes running:

1. IDE
2. The test
3. The Derby server:
2530 84445 84438   0  9:08AM ?? 0:27.71 /usr/bin/java -jar
/Users/dmclean/Library/java/db-derby-10.12.1.1-bin/lib/derbyrun.jar server
start

When my test spawns the "server shutdown", the "server start" process exits
shortly afterward, except that it prints a message on its STDOUT:

Wed Nov 23 09:09:25 EST 2016 : Invalid reply from network server:
Insufficient data

Something is definitely not working correctly and it would be really
helpful if I could figure out what the problem is.

val p = new ProcessBuilder("/usr/bin/java", "-jar",
"/Users/dmclean/Library/java/db-derby-10.12.1.1-bin/lib/derbyrun.jar",
"server", command)
val commandArray = p.command().toArray()
val commandList = commandArray.toList
logger.trace("[runDBCommand] command is: {}", commandList)

val now = new Date()
val outputFile = new File("derby" + dateFormat.format(now) + ".out")
p.redirectOutput(outputFile)
p.redirectError(new File("derby" + dateFormat.format(now) + ".err"))

addEnvironmentVariables(p)
val result = p.start()



On Tue, Nov 22, 2016 at 10:22 AM, Bryan Pendleton <
bpendleton.de...@gmail.com> wrote:

> On 11/22/2016 7:14 AM, Donald McLean wrote:
>
>> it can't bind to the port one minute and then get connections the next?
>>
>>
> Perhaps you accidentally started two copies of the Network Server, in the
> same directory and (trying to) listen on the same port.
>
> Both servers are writing messages to the same derby.log file, but only one
> of them is successfully accepting connections; the other one may have
> tried to start, received the "can't bind" error, then quit?
>
> Perhaps use the 'ps' command to have a close look at which 'java'
> processes are running on your machine.
>
> Or be more thorough: reboot your machine, then start the Network Server,
> then check the ps command to make sure all is well, then shut it down,
> and see if it's acting better now?
>
> thanks,
>
> bryan
>
>
>


-- 
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Re: Unexplained problem

2016-11-22 Thread Donald McLean
Hi Bryan,

The contents of the derby.log are confusing to me (see below). How can it
be complaining that it can't bind to the port one minute and then get
connections the next?

Tue Nov 22 10:10:06 EST 2016 : Apache Derby Network Server - 10.12.1.1
- (1704137) started and ready to accept connections on port 2148
Tue Nov 22 10:10:06 EST 2016 : Could not listen on port 2148 on host localhost:
 java.net.BindException: Address already in use (Bind failed)
An exception was thrown during network server startup.
DRDA_ListenPort.S:Could not listen on port 2148 on host localhost:
 java.net.BindException: Address already in use (Bind failed)
java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:498)
   at org.apache.derby.iapi.jdbc.DRDAServerStarter.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.Exception: DRDA_ListenPort.S:Could not listen on
port 2148 on host localhost:
 java.net.BindException: Address already in use (Bind failed)
   at 
org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessageWork(Unknown
Source)
   at 
org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessage(Unknown
Source)
   at org.apache.derby.impl.drda.NetworkServerControlImpl.blockingStart(Unknown
Source)
   ... 6 more
Tue Nov 22 10:10:07 EST 2016 : Connection number: 1.
Tue Nov 22 10:10:08 EST 2016 : Connection number: 2.

Tue Nov 22 10:10:10 EST 2016:
Booting Derby version The Apache Software Foundation - Apache Derby -
10.12.1.1 - (1704137): instance a816c00e-0158-8c96-3a19-62666399
on database directory
/Users/dmclean/IdeaProjects/aoiJWSTbuild7/MyDbTest with class loader
sun.misc.Launcher$AppClassLoader@6bc7c054
Loaded from 
file:/Users/dmclean/Library/java/db-derby-10.12.1.1-bin/lib/derby.jar
java.vendor=Oracle Corporation
java.runtime.version=1.8.0_112-b16
user.dir=/Users/dmclean/IdeaProjects/aoiJWSTbuild7
os.name=Mac OS X
os.arch=x86_64
os.version=10.11.6
derby.system.home=/Users/dmclean/IdeaProjects/aoiJWSTbuild7
Database Class Loader started - derby.database.classpath=''
Tue Nov 22 10:10:14 EST 2016 Thread[DRDAConnThread_2,5,main] (DATABASE
= MyDbTest), (DRDAID = {2}), Apache Derby Network Server connected to
database MyDbTest
Tue Nov 22 10:10:23 EST 2016 : Connection number: 3.
Tue Nov 22 10:10:23 EST 2016 Thread[DRDAConnThread_3,5,main] (DATABASE
= MyDbTest), (DRDAID = {3}), Apache Derby Network Server connected to
database MyDbTest
Tue Nov 22 10:10:24 EST 2016 : Connection number: 4.



On Tue, Nov 22, 2016 at 9:36 AM, Bryan Pendleton  wrote:

> On 11/21/2016 1:52 PM, Donald McLean wrote:
>
>> I'm trying to run a Derby in server mode. When I go to shut it down, I'm
>> getting this weird error:
>>
>> Mon Nov 21 16:19:44 EST 2016 : Invalid reply from network server:
>> Insufficient data.
>>
>> The command line arguments:
>>
>> /usr/bin/java, -jar, /Users/dmclean/Library/java/db
>> -derby-10.12.1.1-bin/lib/derbyrun.jar, server, shutdown
>>
>> Does anyone have any suggestions as to what the problem would be and how
>> to fix it?
>>
>> Thank you,
>>
>> Donald
>>
>
>
> I don't think I recall having seen that before. There are some old jobs
> in the Derby issues database (e.g., DERBY-6337) that indicate that if the
> Network Server is slow to respond, or slow to shut down, then the client
> may print some odd messages.
>
> Does this happen *every* time you shut down the Network Server?
>
> What does the end of your derby.log file look like?
>
> thanks,
>
> bryan
>
>


-- 
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Unexplained problem

2016-11-21 Thread Donald McLean
I'm trying to run a Derby in server mode. When I go to shut it down,
I'm getting this weird error:

Mon Nov 21 16:19:44 EST 2016 : Invalid reply from network server:
Insufficient data.

The command line arguments:

/usr/bin/java, -jar,
/Users/dmclean/Library/java/db-derby-10.12.1.1-bin/lib/derbyrun.jar,
server, shutdown

Does anyone have any suggestions as to what the problem would be and how to
fix it?

Thank you,

Donald


Puzzling error

2016-08-04 Thread Donald McLean
I am running Derby 10.12.1.1 under Java 1.8.0u102.

I am getting an exception trying to delete a record that I added not long
before (as part of a unit test) (see stack trace below).

Any thoughts, hints, or ideas as to what I'm doing wrong would really be
appreciated.

Thank you,

Donald

Caused by: java.sql.SQLException: Exception during creation of file
/Users/dmclean/IdeaProjects/aoiIteration16/testPersStore/tmp/T1470320730508.tmp
for container
   at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
~[derby.jar:na]
   at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown
Source) ~[derby.jar:na]
   at 
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown
Source) ~[derby.jar:na]
   at 
org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:204)
~[hibernate-core-5.0.5.Final.jar:5.0.5.Final]
   ... 36 common frames omitted
Caused by: org.apache.derby.iapi.error.StandardException: Exception
during creation of file
/Users/dmclean/IdeaProjects/aoiIteration16/testPersStore/tmp/T1470320730508.tmp
for container
   at org.apache.derby.iapi.error.StandardException.newException(Unknown
Source) ~[derby.jar:na]
   at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
Source) ~[derby.jar:na]
   ... 48 common frames omitted
Caused by: java.io.FileNotFoundException:
/Users/dmclean/IdeaProjects/aoiIteration16/testPersStore/tmp/T1470320730508.tmp
(No such file or directory)
   at java.io.RandomAccessFile.open0(Native Method) ~[na:1.8.0_102]
   at java.io.RandomAccessFile.open(RandomAccessFile.java:316) ~[na:1.8.0_102]
   at java.io.RandomAccessFile.(RandomAccessFile.java:243) ~[na:1.8.0_102]
   at org.apache.derby.impl.io.DirRandomAccessFile.(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.io.DirFile.getRandomAccessFile(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.store.raw.data.RAFContainer.run(Unknown
Source) ~[derby.jar:na]
   at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_102]
   at org.apache.derby.impl.store.raw.data.RAFContainer.createContainer(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.store.raw.data.FileContainer.createIdent(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.store.raw.data.FileContainer.createIdentity(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.services.cache.ConcurrentCache.create(Unknown
Source) ~[derby.jar:na]
   at 
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.addContainer(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.store.raw.xact.Xact.addContainer(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown
Source) ~[derby.jar:na]
   at 
org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
Source) ~[derby.jar:na]
   at 
org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown
Source) ~[derby.jar:na]
   at 
org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.sql.execute.UpdateResultSet.open(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown
Source) ~[derby.jar:na]
   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown
Source) ~[derby.jar:na]
   ... 41 common frames omitted


Re: NFS and Derby

2010-11-11 Thread Donald McLean
A "local" database on an NFS mounted disk? I would never consider such a thing.

My experience with NFS mounted resources is that network congestion
can cause all sorts of nasty side effects. Even something as simple as
an unexpectedly slow read or write can cause unanticipated cascading
failure conditions. And no matter what value is used for a timeout,
you can pretty much guarantee that it will be exceeded eventually.

I realize that this doesn't address Derby specific concerns such as
database corruption. Fortunately, I have no experience with that.

Donald

On Thu, Nov 11, 2010 at 10:56 AM, Kathey Marsden
 wrote:
> I have always told users they have to have their databases on a local disk
> to ensure data integrity and that  a system crash for an NFS mounted
> database could cause fatal corruption, but had a user this morning take me
> to task on this and ask me to explain exactly why.  I gave my general
> response about not being able to guarantee a sync to disk over the network,
> but want to have a more authoritative reference for why  you cannot count on
> an NFS mounted disk although I did find several places where the sync option
> "favors data integrity" which certainly doesn't sound like a guarantee.
>  Does anyone know a good general reference I can use on this topic to
> support my "you gotta use a local disk" mantra.
>
>
> Also I think our documentation on this topic should be a bit stronger.
>  Currently we just say it may not work and probably should be clearer that
> data corruption could occur.  I will file an issue to beef up the language
> based on the conversation in this thread.
>
> http://db.apache.org/derby/docs/10.5/devguide/cdevdvlp40350.html


Re: instantiating EmbeddedDriver -> FileNotFoundException

2010-09-30 Thread Donald McLean
I'm guessing that it's something really aggravating like a typo in the
classpath.

Donald

On Thu, Sep 30, 2010 at 2:25 PM, Clemens Wyss  wrote:
> Hi all,
> when I try to instantiate the EmbeddedDriver:
> ...
> org.apache.derby.jdbc.EmbeddedDriver driver =
> (EmbeddedDriver) 
> Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
> ...
> I get a FileNotFoundException, unfortunately the missing file is not 
> mentioned:
>
>> Thread [main] (Suspended (exception FileNotFoundException))


Re: Hibernate 3 Outer Join Problem

2010-05-31 Thread Donald McLean
Have you tried explicitly specifying the table? i.e. Project.proj

On Mon, May 31, 2010 at 7:00 AM, anyz  wrote:
> i'm trying to use hibernate 3 with Derby 10.6. Normal queries work good but
> using left outer join creates problem. The query i'm trying loads project
> program if it exists and if programm not exists the project information is
> loaded:
>
> SELECT proj, prog FROM Project
> LEFT OUTER JOIN Program ON Program.programId = Project.programId
> WHERE Project.projectName = '"MyProject"
>
> The error on executing query is :
>
> unexpected token: ON near line 1, column xxx [SELECT proj, prog, FROM
> a.b.Project LEFT OUTER JOIN Program ON Program.programId = Project.programId
> WHERE Project.projectName = 'MyProject' ]
> at org.hibernate.hql.ast.QuerySyntax
>
> Could you please guid if Hibernate dialect support for Derbby is not that
> good of i'm missing something.
>
> thanks
>



-- 
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

Join the photo preservation advocacy Facebook group:
http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288


Re: Full roaming vapor embedded server

2010-05-21 Thread Donald McLean
Have each process "register" in a table set aside for that purpose. As
each process completes, the last thing it does is "unregister". Last
process to finish shuts down the database.

Just a thought.

Donald

On Fri, May 21, 2010 at 5:07 PM, Kathey Marsden
 wrote:
> I hope this doesn't give  anyone else similar ideas, but I need some advice
> :-)
>
> I am trying to help the developers of a Java API  that  uses a Derby
> database to hold centralized information specific to a machine.
> The API gets invoked when products are being installed or upgraded on the
> machine and records product information, versions, dependencies, etc,  but
> otherwise they don't want it to run.
>
> They have a requirement for multiple jvm access, primarily for nested
> installs where one product installation accesses the database and needs to
> launch a child process to install another product.    Their implementation
> starts network server on-demand if it is not started already and then
> connects with the client driver. Additional processes that come in will
> check and find network server running elsewhere so will just connect to the
> already the started server.   They think the "parent" process will always
> come in first, so there is not a risk of one process bringing network server
> down in the middle of someone else's work.
>
> This all seems very fragile to me and is a new and untested configuration,
> but I am having trouble coming up with a good design suggestion.  They at
> one time tried a service but do not want the full time overhead of a server
> running and don't want to require root access to start the service.
>
> Any other ideas?
>
> Thanks
>
> Kathey
>
>
>
>



-- 
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

Join the photo preservation advocacy Facebook group:
http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288


Re: how to include derby.jar in my .class file?

2010-05-09 Thread Donald McLean
You have to build a JAR file that includes your class files and
deby.jar. At least I have heard that you can do this, though I've
never done it myself.

Alternately, there is probably some way to package it as an
application for various platforms (Windows, Mac, Linux).

Donald

On Sun, May 9, 2010 at 6:17 PM, oldmhe  wrote:
>
> I'm new to Java, but am making progress with accessing Derby via the
> "embedded" framework.
>
> My program works as long as CLASSPATH points to derby.jar.
>
> But my preference to deploy the program as a single file, so that the user
> can run it simply with:
>
>     java myprogram [parameters]
>
> without having to set CLASSPATH.
>
> Is there a way to include derby.jar inside my class file (or some other way)
> so as to eliminate the need to set CLASSPATH -- and so the entire deployment
> involves a single file?
-- 
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

Join the photo preservation advocacy Facebook group:
http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288


Re: Determining when shutdown is complete.

2010-04-06 Thread Donald McLean
Are you talking about embedded Derby databases? If you are, the
shutdown always raises an exception when it finishes.

Otherwise, perhaps some more details would be a good idea.

Donald

On Tue, Apr 6, 2010 at 1:53 PM, David Van Couvering
 wrote:
> Hi, all.
>
> In my application environment I am using multiple databases, and when I have
> no users of the database, I need to shut it down, or I can run out of memory
> or open files (I am maintaining a lot of databases).
>
> But this is a multithreaded environment, and I could have another thread
> immediately attempt to connect to the a database that is in the process of
> shutting down.
>
> Is there a way for me to find out when shutdown is complete, so I can block
> other threads from trying to connect until the job is done?  I suppose I
> could just poll, trying to open a new connection and catching exceptions,
> until it stops failing, but is there a better way?
-- 
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

Join the photo preservation advocacy Facebook group:
http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288


Re: 'ERROR 40XD0: Container has been closed.: java.io.IOException'.

2010-02-15 Thread Donald McLean
When working with BLOBs and CLOBs, these sorts of errors are almost always
caused by committed transactions. Since most people don't expect to need a
transaction
 for a select, more often than not autocommit is set to TRUE and the select
commits as soon as it is executed. While this is fine for everything else,
it doesn't work for BLOB/CLOB fields. A BLOB/CLOB is only valid inside a
single transaction and the instant that transaction finished (commit or
rollback) the BLOB/CLOB goes poof.

Donald

On Mon, Feb 15, 2010 at 2:33 AM, Dinesh Bajaj wrote:

> I get the above error while executing the Update statement through a java
> application. The error occurs when the update statement involves a Blob
> field.
>
> I have ensured that input stream being given to setBinaryStream method is
> not closed and the length being given is also correct.
>
> Also, may I say that I can't find any source where I can readily find the
> detailed description of a Derby error and its possible causes. The reference
> documentation just cryptically says : "Container has been closed". Now, what
> can be make out of this?
>
>
>
-- 
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

Join the photo preservation advocacy Facebook group:
http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288


Re: Need help in designing secure database application

2010-02-13 Thread Donald McLean
You could try obfuscation - that is, using nonsense strings that can
be mapped to the real table/column names by your program.

You could add a password to the database, something built into the
software so that users wouldn't even be able to open the database.

On Fri, Feb 12, 2010 at 10:54 PM, Tushar Kale  wrote:
>
> Hi Charlie:
>
> Thanks for the quick response!
> I think  I can use the encrypt=true flag when database is created. This will
> prevent user from opening the database files in OS and dumping them to see
> data. Somehow I need to protect the data structures (tables/relationships
> etc) in the database.
-- 
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

Join the photo preservation advocacy Facebook group:
http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288


Re: XJ073 The data in this BLOB or CLOB is no longer available

2009-12-30 Thread Donald McLean
This condition is very frequently caused when the user has autocommit
set to true. BLOBs and CLOBs can only be used inside a transaction
(i.e. autocommit set to false). Don't forget to commit the transaction
after you have finished with the BLOB/CLOB.

On Tue, Dec 29, 2009 at 5:15 PM, geoffrey hendrey  wrote:
> On Derby 10.4.1.3 I see the following error. "ERROR XJ073: The data in this
> BLOB or CLOB is no longer available.  The BLOB/CLOB's transaction may be
> committed, or its connection is closed." Are there any known issues around
> this? It occurs intermittently, and I've never seen in happen twice in a
> row. I don't think I'm prematurely closing the connection. I found a Jira
> issue around this, but it seemed like the discussion concluded it was user
> error. Thought I would ping the list to see if there are any known bugs on
> this.
-- 
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

Join the photo preservation advocacy Facebook group:
http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288


Re: Derby--Embedded

2009-11-30 Thread Donald McLean
Oracle and other databases (including Derby server mode) - the DB runs
as a separate process and the application talks to it over a network
connection. Embedded databases such as Derby the database runs inside
your application, the database is on a local disk and the application
objects talk directly to the DBMS objects via method calls.

Actually doing the embedding basically requires two things:

1. including derby.jar in your classpath

2. connecting to the database using a URL that specifies a local file

Otherwise - what Rick said - the Derby documentation is pretty
straightforward and useful.

Donald

On Mon, Nov 30, 2009 at 10:50 AM, 120113698 <120113...@qq.com> wrote:
> How can I embed the Derby-Database to a Desktop Java Application?
> and what is the deffirence between using Oracle Database in Deaktop Java
> Apps and using derby in desktop java apps?
-- 
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

Join the photo preservation advocacy Facebook group:
http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288


Re: please help me!

2009-08-31 Thread Donald McLean
You would have to start a Java virtual machine inside the Perl
process. You would then have to make java calls to start and access
the database. I suppose that there might be a Perl library to do
something like this but more than likely you would have to do some C
programming and use JNI. I can imagine that it might be a bit ugly.

On Mon, Aug 31, 2009 at 5:58 AM, chengzhuo wrote:
> Hi derby!
> Can perl access derby in embedded model?
-- 
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

Join the photo preservation advocacy Facebook group:
http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288


Re: How to list database names available in derby server (mysql SHOW TABLES equivalent)

2009-08-15 Thread Donald McLean
I don't believe that there is a "master database" that lists all
databases that have been created on a system. You would have to go
file trawling and I doubt that Derby is set up to do that.

On Sat, Aug 15, 2009 at 12:17 PM, MikeRam wrote:
>
> How to list database names available in derby server (mysql SHOW TABLES
> equivalent) ?%-|
-- 
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

Join the photo preservation advocacy Facebook group:
http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288


Re: Problem with auto-generated identifiers

2009-07-09 Thread Donald McLean
It seems that you would get that if you created a second object before
saving the first one. This could also happen if you had multiple
threads or multiple users accessing a server DB.

I would think that you would want to use "GENERATED ALWAYS AS
IDENTITY" for event_id rather than generating the key through
Hibernate.

On Thu, Jul 9, 2009 at 2:12 PM, Dimka wrote:
>
> I am using embedded derby driver 10.4.2.0 - (689064)  with hibernate
> Every once in a while I'm seeing an exception like this:
>
> "The statement was aborted because it would have caused a duplicate key
> value in a unique or primary key constraint or unique index identified by
> 'SQL090709201522730' defined on 'MYTABLE' "
>
> I haven't seen such problems up until I've started to use auto-generated
> identifiers, like the one below:
>
> 
>        
>        
> 
>
> Fraction of the schema looks like this:
> CREATE TABLE MYTABLE(EVENT_ID BIGINT NOT NULL,  PRIMARY KEY (EVENT_ID))
> CREATE TABLE hibernate_unique_key ( next_hi INTEGER )
> INSERT INTO  hibernate_unique_key VALUES ( 0 )
>
> The exception is thrown sometimes, not all the time.. I can't figure out why
> and when.
> This is the most frustrating thing.
> Can anyone give me a direction of where to look?
-
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Re: How would you implement a record-level versioning system with Derby and Java?

2009-07-09 Thread Donald McLean
On Thu, Jul 9, 2009 at 10:44 AM, Alessandro Bottoni wrote:
> Donald McLean ha scritto:
>> I have used and recommend Hibernate. It simplifies things immensely
>> IMO, though it does have its quirks (some of which are not properly
>> explained by the documentation). It also works well with a number of
>> other DBMS (if changing is something that might happen later).
>
> Thanks. I'm new to Hibernate, as well, so I'm going to ask you (all)
> which book is best for learning Hibernate. I browsed a little bit on
> Amazon's but I did not find anything to be enthusiastic about. What
> would you suggest me as a good starting point/introductory book?
>
> Any good web article/tutorial to signal, as well?

I used only the included reference and experimented a bit.
-
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Re: How would you implement a record-level versioning system with Derby and Java?

2009-07-09 Thread Donald McLean
I like that idea. You could even create different tables for different epochs.

On Thu, Jul 9, 2009 at 10:32 AM, Peter Ondruška wrote:
> Actually I would store the history values outside the main table for
> performance and storage overhead reasons (history table may have
> additional columns, e.g. When-who-etc for auditing information). Peter
-
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Re: How would you implement a record-level versioning system with Derby and Java?

2009-07-09 Thread Donald McLean
On Thu, Jul 9, 2009 at 9:03 AM, Alessandro Bottoni wrote:
> Hi Guys,
> I'm completely new to Derby and I evaluating it as a possibile embedded
> RDBMS for a Java/Swing application that I'm goig to develop. I'm
> currently following the tutorials at IBM DeveloperWorks
> (http://tinyurl.com/6mlwpj) and I have ordered the IBM book at Amazon's
> already (http://tinyurl.com/ln3cas).
>
> I have a stimulating question for you all (I apologize if this topic has
> been discussed already):
>
> how would you implement a system to keep track of any old version of a
> record (row) of your database?
>
> I'm asking this because I need a system that will allow the user to see
> any old version of a record and to undo/redo any change with just a
> couple of mouse clicks.
>
> Any idea? Any suggestion?

Actually, this is a question that I have previously considered for a
project that I am starting.

My thought was to have an identity column (value assigned by the DBMS)
and a separate ID column. From here, you can do several different
things:

1. Have a "version" column. Use the max function to find the current
version, or make the current version -1 or something else easy to
find.
2. Use the max function on the identity column to find the latest version.
3. Have "previous" and "next" columns with the identity values of the
appropriate objects in the chain. The current version would have a
null "next".

There are probably other approaches that I haven't thought of.

> PS: No, I'm not planning to use any kind of ORM (Hibernate or similar).
> Should I?

I have used and recommend Hibernate. It simplifies things immensely
IMO, though it does have its quirks (some of which are not properly
explained by the documentation). It also works well with a number of
other DBMS (if changing is something that might happen later).
-
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Re: Checking if a db is open without actually opening it

2009-07-03 Thread Donald McLean
The easiest thing would probably be to look for the lock file.

On Fri, Jul 3, 2009 at 1:41 PM, Alan Burlison wrote:
> I'm wrapping the Derby replication stuff with some safety checks, and I want
> to make sure that the slave DB isn't currently open before I overwrite it.
>  Is there any way of asking Derby if it has a database open without opening
> it as a result?
-
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Overhead for varchar and clob

2009-06-26 Thread Donald McLean
I'm working on something where I need to store strings of
indeterminate length and I'm curious about the difference in storage
costs for varchar vs clob. I'm not going to make my decision based on
the difference - disk space is too cheap for it to be that big of a
deal, but I don't like making decisions without better information.

If some kind soul who is familiar with the inner workings of these two
types could talk about them a bit, I would be grateful.

Donald
-
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Re: Question About Selecting Only Some Records in a Join Query

2009-06-20 Thread Donald McLean
It seems to me that you could probably use a subquery to get the last date
of service. It's a bit more complicated with separate fields for the date
parts. You might even have to use nested subqueries. Get the largest service
year, use that as a key and get the largest month for records in that
service year and then get the largetst service day in that service
year/month and then use that to select records from the table.


Re: Setting up my derby data base...

2009-06-16 Thread Donald McLean
James,

I doubt that you will find the kind of documentation that you are
looking for. Developers tend to be an independent do-it-yourself lot
so you would probably get more help posting specific error messages
and asking specific questions.

Just my tupence.

Donald
-
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Re: Embedded Derby w/Hibernate

2009-05-21 Thread Donald McLean
Did you create the tables? You have to use regular SQL to actually
create the tables in the database before you can access them with
Hibernate.

On Thu, May 21, 2009 at 1:53 PM, Nicola DiPasquale
 wrote:
> Hello, I am attempting to use an embedded Derby instance wrapped with
> Hibernate and Hibernate Annotations.  However, after the tables are
> initialized by Hibernate, the first time that I attempt to access the
> tables Derby throws exceptions that claims the tables and views do not
> exist.  When I restart the application everything works fine (because
> the tables already exist in the database on load).  How can I possibly
> alleviate this problem (without pulling Derby out into server mode)?
-
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Re: Good, thin, ORM layer

2009-04-29 Thread Donald McLean
I've become quite fond of Hibernate (hibernate.org) - though I'm
firmly convinced that most of their contributors are from some
strange, distant planet.

On Wed, Apr 29, 2009 at 5:58 PM, Maggi Federico
 wrote:
> Hello List,
>
>        I love embedded stuff. I love SQLite and I love Derby even more.
> However, I was wandering, is there any good, thin, ORM layer which is
> entailed for small applications that use Derby?
>
> I found ActiveObjects pretty neat and I like the "conventions rather than
> configuration" philosophy. However, I think it's sometimes unstable though
> really promising.
>
> What would you suggest? Thanks in advance,
-
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Re: How to read blobs?

2009-03-05 Thread Donald McLean
You cannot use blobs with autocommit(true). It just doesn't work.

Donald

On Thu, Mar 5, 2009 at 8:38 AM, epdv  wrote:
>
> Hello!
>
> I want to read blobs in a loop (more exact: the length of the blobs). I'm
> using a connection with autocommit(true) and a prepared statement with sth.
> like "select mydata, myblob where mykey=?".
-
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Re: reduce open file count

2008-12-08 Thread Donald McLean
I would guess that each file is a table or index.

So, the answer (short of rewriting the software from scratch) is probably no.

On Fri, Dec 5, 2008 at 4:36 PM, Geoff hendrey <[EMAIL PROTECTED]> wrote:
> Each derby database seems to create 65 .dat files. Is there a way to reduce
> this?

-
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Re: procedure to upgrade or create an embedded database

2008-12-08 Thread Donald McLean
It is reasonably easy to find out if the database exists in Java -
create a File object with the correct path. If "exists()" returns
false then create it, otherwise you can upgrade it.

Donald

On Sat, Dec 6, 2008 at 12:45 PM, Brian Peterson <[EMAIL PROTECTED]> wrote:
> I'm trying to figure out how to determine what connection parameters for an
> embedded database I should use when there might not be a database in place
> (so "create=true"), or there might be an older version already in place (so
> "upgrade=true"), or there might already be a database of the right version
> in place (so "create" or add nothing to the URL).
>
> I read that "upgrade" and "create" cannot both be specified in the
> connection URL. If I'm putting out a release of my application that uses the
> latest version of Derby (10.4) while a previous version used 10.2.2, what
> are the recommended steps for making the connection to the Derby database if
> one is already present? (Note that I have to handle this programmatically as
> part of the application startup.)
>
> Do I first try a URL with "create" and see if there's an error, and if so,
> follow up with a call with "upgrade"? Or do I have the procedure always use
> "upgrade" and follow up with a URL with "create" if it fail to make a
> connection?

-
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Re: Can we force create a database?

2008-11-10 Thread Donald McLean
It shouldn't be all that tedious. Here's the code that I wrote. I use
it to delete the database in some of my unit tests:

public static boolean deleteAnyFile(File file)
{
//System.out.println("[DBUtilities.deleteAnyFile] enter.");
if (!file.exists())
{
return true;
}

if (!file.isDirectory())
{
return file.delete();
}

return deleteDirectory(file);
}


/**
 * @param directory - item to be deleted.
 * @return success or failure
 */
private static boolean deleteDirectory(File directory)
{
File[] contents = directory.listFiles();
for (int i = 0; i < contents.length; i++)
{
File next = contents[i];
boolean result = deleteAnyFile(next);
if (!result)
{
return false;
}
}

return directory.delete();
}

On Sun, Nov 9, 2008 at 6:03 PM, Emmanuel Cecchet <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I had a situation with a crashed Derby database in a replicated scenario
> with Sequoia (so it's ok because Sequoia is ready to handle this kind of
> problems).
> However, the URL used by Sequoia was of the form
> 'jdbc:derby:mydb;create=true'. Unfortunately the database crashed in a state
> that fooled Derby so that it generates an 'ERROR XBM0J' saying that the
> directory exist and that Derby will cowardly refuse to create the database.
> Is there a way to force Derby to create the database or do we have do
> manually remove the directory content beforehand (which is quite tedious)?
> Does anyone know if the issue would be the same with createFrom instead of
> create?
-
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Re: How to store values that might be given in different measurement units?

2008-10-15 Thread Donald McLean
I don't think that separate columns for each type of unit would be a
good choice. I agree with Roy that the most straightforward approach
would be to just convert to a standard unit. Where I work this is what
most people (including me) do.

However, if you want an alternate approach, you could store the value
in one column and the units in another.

On Wed, Oct 15, 2008 at 6:58 AM, Stanley Styszynski <[EMAIL PROTECTED]> wrote:
> Hi All,
> I would appreciate any thoughts on the following topic:
> How to store values that might be given in different measurement units?
> For example weight. It can be in pounds or kilograms.
> Basically, I am writing an application in which user can enter some values
> (weight, height and some medical measurements)
> in different units and I want to store this in Derby database. I don't know
> if it would be better to store these values in one unit
> and convert it if needed or to create separate columns for each possible
> unit and retrieve them using special query?
> Maybe there is some other way of doing this?
-
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.


Peer replication

2008-09-29 Thread Donald McLean
We're working on an application where we have multiple servers and we
need to replicate transactions between the servers to allow failover
and load balancing. I think that this is different from the
replication that Derby supports because it is peer-to-peer rather than
master/slave. Has anyone worked with this sort of replication before?

Donald


Re: checking for the existence of tables, how?

2008-09-18 Thread Donald McLean
On Thu, Sep 18, 2008 at 7:42 AM, Maarten Meijer <[EMAIL PROTECTED]> wrote:
> I have an application that store data locally in a embedded database.
> it uses ;create=true in the jdbc URL so the db is created if it is not
> already there.
> But next I would like to query it for the existence of some tables.
> How can I do that?
>
> More in general, how can i get meta data such as column names from a Derby
> DB?

In IJ you can use "show tables" to see the system tables (see below).
sys.systables and sys.syscolumns should tell you what you want to
know.

Donald

ij> show tables;
TABLE_SCHEM |TABLE_NAME|REMARKS

SYS |SYSALIASES|
SYS |SYSCHECKS |
SYS |SYSCOLPERMS   |
SYS |SYSCOLUMNS|
SYS |SYSCONGLOMERATES  |
SYS |SYSCONSTRAINTS|
SYS |SYSDEPENDS|
SYS |SYSFILES  |
SYS |SYSFOREIGNKEYS|
SYS |SYSKEYS   |
SYS |SYSROLES  |
SYS |SYSROUTINEPERMS   |
SYS |SYSSCHEMAS|
SYS |SYSSTATEMENTS |
SYS |SYSSTATISTICS |
SYS |SYSTABLEPERMS |
SYS |SYSTABLES |
SYS |SYSTRIGGERS   |
SYS |SYSVIEWS  |


Re: Running derby in an applet continuously?

2008-09-17 Thread Donald McLean
You might have to reduce your site to one page and use AJAX (or
something similar) to fill in the content. If I'm not mistaken, the
applet goes away when you change pages.

It might be possible to use frames and have the applet run in one
frame and have the other frame be dynamic.

This seems like a rather peculiar requirement. You might have to
experiment with different approaches.

Donald

On Tue, Sep 16, 2008 at 4:03 PM, ScottDerrick <[EMAIL PROTECTED]> wrote:
>
> I am using embedded derby in an applet.
>
> I need to have it be running whenever the user is on my site, no matter what
> page they are on.
>
> How can I do this?


Re: cannot invoke other java.sql.Clob

2008-07-21 Thread Donald McLean
I've seen cases like this where autocommit didn't seem to want to STAY
off. Try turning it off just before the select - just to be completely
sure. What could it hurt?

Donald

On Mon, Jul 21, 2008 at 11:51 PM, Daniel Noll <[EMAIL PROTECTED]> wrote:
> Donald McLean wrote:
>>
>> With clobs and blobs this error is almost always caused by autocommit.
>> When autocommit is on, the select is committed before you get a chance
>> to retrieve the value of the clob or blob column. Obviously then, if
>> you are going to select a clob or blob column, you have to turn it off
>> first.
>>
>> Sometimes this is inconvenient, but can't be avoided.
>
> We don't have autocommit turned on either.  Or rather, we explicitly turn it
> off after getting the connection.


Re: cannot invoke other java.sql.Clob

2008-07-21 Thread Donald McLean
With clobs and blobs this error is almost always caused by autocommit.
When autocommit is on, the select is committed before you get a chance
to retrieve the value of the clob or blob column. Obviously then, if
you are going to select a clob or blob column, you have to turn it off
first.

Sometimes this is inconvenient, but can't be avoided.

Donald


Re: Safe backups

2008-07-18 Thread Donald McLean
That's what I did for a long time and I didn't have any problems. That
doesn't mean that properly closing/shutting down things isn't a good
habit to get into.

Donald

On Thu, Jul 17, 2008 at 11:45 PM, Amir Michail <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Would it be sufficient to shut down tomcat (using
> /etc/init.d/tomcat5.5 stop) before copying derby databases?
>
> What would happen to open connections if I do this?  Could the copy be 
> corrupt?


Re: Portability issue for 'Like-clause' on non-string types ?

2008-06-26 Thread Donald McLean
I'm guessing that it wants a string type. You will probably have to
use a CAST. I'm not sure of the exact syntax, but I think that it
might look something like this:

select cast(sc.id as varchar) as sc_id from sms_command sc where sc_id like "%"

On Thu, Jun 26, 2008 at 12:42 AM, Albert Kam <[EMAIL PROTECTED]> wrote:
>
> ij> select sc.id from sms_command sc where sc.id like '%';
> ERROR 42884: No authorized routine named 'LIKE' of type 'FUNCTION' having
> compatible arguments was found.

Donald


Re: Derby database directory on Tomcat ?

2008-06-26 Thread Donald McLean
On Thu, Jun 26, 2008 at 12:52 AM, Albert Kam <[EMAIL PROTECTED]> wrote:
>
> Anyway, i just want to ask whether there's a clean place to specify the
> location of
> the derby database directory ?

In the URL. See, for example, the source code for DatabaseManager:

http://wiki.apache.org/db-derby/DatabaseManagerSource

In the function createURL, the database location is specified by a File.

Donald


Re: Derby in Tomcat webapps

2008-05-31 Thread Donald McLean
Sample code - always the perfect gift.

Thank you, Alan.

On Sat, May 31, 2008 at 3:40 AM, Alan Burlison <[EMAIL PROTECTED]>
wrote:

> Donald McLean wrote:
>
>  I would greatly appreciate some suggestions as to how I should modify my
>> configuration so that I can resolve these problems.
>>
>
>
> http://auth.opensolaris.org/svn/showfile.svn?path=%2ftrunk%2fAuthDb%2fsrc%2forg%2fopensolaris%2fauth%2fdb%2fDbManager.java&revision=HEAD&name=auth
>


Re: Derby in Tomcat webapps

2008-05-29 Thread Donald McLean
On Thu, May 29, 2008 at 12:11 PM, Robert J. Carr <[EMAIL PROTECTED]> wrote:

> > 1. When I unload and then reload the app, the new instance of the app
> can't
> > start the database. I have to stop and then start Tomcat.
>
> My application runs in tomcat and I can deploy and undeploy my app and
> the database is fine and I'm able to reconnect.  Are you unloading the
> database when you undeploy?


Hmmm. Perhaps not. What exactly do you mean by "unloading the database"?


> > 2. When I try to run a second app that uses Tomcat, it can't start the
> > database.
>
>
> If you are using embedded derby, as far as I know, you can only have
> one active connection to it at a time.
>
> You might be able to get around this using JNDI data sources, which I
> think ties the connection to tomcat and not to your application.  I
> haven't confirmed this, but it is worth a shot if you're not already
> doing it (and a better practice as well).
>

My apologies for being unclear. I'm not trying to open a connection to the
same database, I'm trying to open a connection to a different database. I
suspect this is some kind of class loader issue.

Thank you,

Donald


Derby in Tomcat webapps

2008-05-29 Thread Donald McLean
The new version of our webapp uses Tomcat (and it works like a champ!) but
there are a couple of annoying issues that I would like to resolve:

1. When I unload and then reload the app, the new instance of the app can't
start the database. I have to stop and then start Tomcat.

2. When I try to run a second app that uses Tomcat, it can't start the
database.

I would greatly appreciate some suggestions as to how I should modify my
configuration so that I can resolve these problems.

Thank you,

Donald


Re: SYSCS_UTIL.SYSCS_IMPORT_TABLE

2008-05-27 Thread Donald McLean
You can't set the value of an "identity always" column. You have to leave it
out of the inserted values and you have to specify all of the other columns
in the function call.

On Tue, May 27, 2008 at 12:14 PM, Pablo Vázquez Blázquez <
[EMAIL PROTECTED]> wrote:

> Hello,
>
> I am trying to perform a SYSCS_UTIL.SYSCS_IMPORT_TABLE operation, but I
> recieve the following error:
>
>   [sql] Executing file:
> C:\CVSROOT\scheduler-test\database\script\ImportDerbyDB.sql
>   [sql] [ERROR] Failed to execute:  CALL SYSCS_UTIL.SYSCS_IMPORT_TABLE
> (NULL, 'SCHED_PROJECTS', 'database/data/SCHED_PROJECTS.del', null, null,
> 'UTF-8', 0)
>   [sql] [ERROR] java.sql.SQLException: The exception
> 'java.sql.SQLException: Attempt to modify an identity column 'ID'.' was
> thrown while evaluating an expression.
>
> Why do I recieve this error? Isn't it suppossed to be inserting the files
> at SCHED_PROJECTS.del file? Is there any way of disabling constraints before
> executing IMPORT?
>


Re: How to store many large files in the database?

2008-05-23 Thread Donald McLean
I believe that FAT32 drives have a 4GB limit. I bought an extra external
hardrive for backups not realizing that it was FAT32.

On Fri, May 23, 2008 at 12:34 PM, Six Fried Rice <[EMAIL PROTECTED]>
wrote:

> On May 22, 2008, at 6:31 PM, Christian Gruber wrote:
>
>  the maximum size of a table is the maximum file size of the underlying
>> operating system (e.g.: 2 GB).
>>
>
> I'm curious where the 2GB limit is coming from. Are you certain your max
> file size is 2GB in your environment? For reference, here are max file sizes
> for common filesystems:
>
> NTFS: 16 terabytes
> HFS+ (Mac OS X): 8 exabytes (8 million terabytes)
> EXT3: 16GB - 2TB depending on block size
>
> Is the 2GB a Java limitation? Or perhaps related to some filesystem APIs in
> use?
>


Re: How to make a simple app with a Java Db embedded ?

2008-03-26 Thread Donald McLean
Actually, just having an embedded database is pretty simple. If you look at
the source for the simple class DatabaseManager (
http://wiki.apache.org/db-derby/DatabaseManagerSource) it lays it all out
for you but in essence you need to:

1. load the driver (static block at the end)

2. create a proper URL for the database (function creatURL)

3. connect to the database (function connectToDatabase)

Donald

On Wed, Mar 26, 2008 at 10:53 PM, Ricardo Seromenho <[EMAIL PROTECTED]> wrote:

> Hello,
> I am using NetBeans IDE 6.0 and having some difficult to make a simple
> app with a embedded database.
>
> What I am able to do is an application with a database but not ebedded...
>
> So, what I need to do to embedde that database on the application?
>


Re: Closig connection vs shutting down derby

2008-03-09 Thread Donald McLean
The DatabaseManager library which run Derby in embedded mode just closes all
of the connections and the database shuts itself down when the last
connection is closed.

Donald

On Sun, Mar 9, 2008 at 9:16 PM, musky <[EMAIL PROTECTED]> wrote:

>
> I have a doubt:
>
> i an application after obtaining a connection to a database and after i
> perform all required transactions on the tables of the database do i need
> to
> shutdown the database or is it enough if i just close the connection.
>
> i tried shutting down the database but i get the
> nontransientconnectionexception sql state:08006
>


Re: Storing array in database

2008-03-05 Thread Donald McLean
I'm prettty sure that Derby does not support that feature.

Donald

On Wed, Mar 5, 2008 at 11:02 PM, musky <[EMAIL PROTECTED]> wrote:

>
> i want to know how to use getarray and setarray methods to store and
> retrieve arrays in derby.
>
> i came across something called embedpreparedstatement20 and that statement
> had the method setarray.
>
> someone please tell me how this can be done.
>
>


Re: sql format in *.sql files

2008-02-14 Thread Donald McLean
In a tool like "ij" the semicolons are used to delimit individual
statements. In JDBC you don't use them because you can only run one
statement at a time.

Donald


Re: Using derby as a chat server

2008-02-13 Thread Donald McLean
Yes, you would use a timer. You'll have to experiment with the timing (too
often and it thrashes).

You would select any message newer than the last message that was retrieved.

On Feb 13, 2008 7:49 PM, musky <[EMAIL PROTECTED]> wrote:

>
> then how do i have a thread periodically select the latest message from
> the
> table?
> should i use a timer or something
>
> Donald McLean-3 wrote:
> >
> > You might also want to have a messageID and maybe a messageTimestamp.
> >
> > If everyone is connecting directly to the database server then you're
> just
> > going to have to do a select periodically to see if anyone posted
> anything
> > new.
> >
> > I don't know what kind of connection limits a database server has, but
> if
> > your target audience is large enough, your architecture could break down
> > (or
> > even just bog down).
> >
> > On Feb 13, 2008 10:06 AM, musky <[EMAIL PROTECTED]> wrote:
> >
> >>
> >> also i dont want to use any sockets.
> >> all the chat clients connect to the database server.
> >>
> >> musky wrote:
> >> >
> >> > i want to use derby as a chat server,
> >> > my idea is to insert whatever a user types into a table in the
> >> > database.This table can have two fields UserID and the
> >> > message(VARCHAR).how do i convey the inserted message to the other
> >> party??
>
>


Re: Using derby as a chat server

2008-02-13 Thread Donald McLean
You might also want to have a messageID and maybe a messageTimestamp.

If everyone is connecting directly to the database server then you're just
going to have to do a select periodically to see if anyone posted anything
new.

I don't know what kind of connection limits a database server has, but if
your target audience is large enough, your architecture could break down (or
even just bog down).

On Feb 13, 2008 10:06 AM, musky <[EMAIL PROTECTED]> wrote:

>
> also i dont want to use any sockets.
> all the chat clients connect to the database server.
>
> musky wrote:
> >
> > i want to use derby as a chat server,
> > my idea is to insert whatever a user types into a table in the
> > database.This table can have two fields UserID and the
> > message(VARCHAR).how do i convey the inserted message to the other
> party??
>
>


Re: Rich text format in apache

2008-02-12 Thread Donald McLean
Rich text is just that, text. You can store it in any appropriate length
text field (varchar or clob).

On Feb 12, 2008 6:52 AM, musky <[EMAIL PROTECTED]> wrote:

>
> how do i store richtext into an apache database?
>
> any help will be appreciated.
>
> can this be done without using any tags..
>
>


Re: derby databse connection in Hibernate

2008-02-12 Thread Donald McLean
I believe that this error means that there is no Hibernate map
(hbm.xmlfile) that maps some class to that table in your database.

On Feb 12, 2008 1:47 AM, cnapagoda <[EMAIL PROTECTED]> wrote:

> ** My datadase name is power_moniter, table name is userinfo. why i'm I
> got error like that? thank you.
>


Re: Help with performance of apache derby server

2008-01-21 Thread Donald McLean
Well, I would use a DB independent object-relational mapper (such as
Hibernate) and then try the one that you think would be the easiest
(embedded Derby is pretty darn easy!). If it doesn't give you the
performance that you want, try something else.

Donald

On Jan 21, 2008 7:16 AM, musky <[EMAIL PROTECTED]> wrote:
>
> is it a good idea to use apache derby for this kind of project or should i
> look at mysql server.
>
> please tell me which is better suited.


Re: Derby complains on SQL that has ORDER BY that order column is not in query result, but it's there

2008-01-20 Thread Donald McLean
But didn't you select it "as pos18_37_"?

On Jan 20, 2008 9:35 AM, Roman Puchkovskiy
<[EMAIL PROTECTED]> wrote:
>
> as visibility17_37_, menuitem0_."pos" as pos18_37_, menuitem0_."js_onclick"
>
> Error is produced: "The ORDER BY clause may not contain column 'pos', since
> the query specifies DISTINCT and that column does not appear in the query
> result."
>
> But "pos" column is in 'select' clause!


Re: getImportedKeys() and getTables() return no rows

2008-01-04 Thread Donald McLean
At least one case was documented on the Wiki:

http://wiki.apache.org/db-derby/DerbySQLroutines

(under Common Problems, at the bottom)

On Jan 4, 2008 2:27 PM, Daniel John Debrunner <[EMAIL PROTECTED]> wrote:
> blyon wrote:
> > Thanks for the advice, it works as expected when I use ALL UPPER CASE. But,
> > isn't it rather odd that some functions are case-sensitive for table names
> > and others are not?
>
> I'm curious, which methods are case-insensitive for table names?


Re: Check for DB Existence on Start

2008-01-03 Thread Donald McLean
Dear Magnus,

On the Derby Wiki, I have posted the source for a DatabaseManager class that
does this (among other things):

http://wiki.apache.org/db-derby/DatabaseManager

The current version of DatabaseManager does much more but unfortunately I am
not free to post that source code.

Donald

On Jan 3, 2008 9:43 AM, Magnus Prime <[EMAIL PROTECTED]> wrote:

>
> Hi.
>
> I am fairly new to derby, but I am enjoying it so far.  What I want to
> know, is there a way to connect to Derby, and check that the DB you want to
> use exists, and if not, then go create it.
>
> I am using the embedded driver (in a Java program), and I know I can add
> the ;create flag to the URL, but does that have any adverse effects if the
> DB has already been created?
>
> The end result of what i am trying to accomplish, is that the first time
> the program is run, create the required DB and its tables/sample data, and
> from then on, dont create it if it already exists.
>
>


Re: Docs in alternate PDF format

2007-12-21 Thread Donald McLean
Dear Thomas,

Well, considering the depth and detail of your reply, I think that the wait
was more than worth it.

Thank you very much.

Donald

On Dec 21, 2007 5:19 AM, Thomas Nielsen <[EMAIL PROTECTED]> wrote:

> Hi Donald,
>
> Sorry for the late reply.
>
>


Docs in alternate PDF format

2007-12-19 Thread Donald McLean
Has anyone tried to recreate the documentation in a PDF format with a
smaller page size?

My lovely spouse bought me a Sony PRS-505 ebook reader and 8.5x11 pages come
out frighteningly cramped (but still legible) on its 3.5x4.75 inch screen. I
was thinking that documents that I refer to regularly would be a useful
thing to put on it.

Thank you,

Donald


Docs in alternate PDF format

2007-12-19 Thread Donald McLean
Has anyone tried to recreate the documentation in a PDF format with a
smaller page size?

My lovely spouse bought me a Sony PRS-505 ebook reader and 8.5x11 pages come
out frighteningly cramped (but still legible) on its 3.5x4.75 inch screen. I
was thinking that documents that I refer to regularly would be a useful
thing to put on it.

Thank you,

Donald


Re: Successful Delivery

2007-12-19 Thread Donald McLean
"We" are the Exposure Time Calculator (ETC) development team from the Space
Telescope Science Institute (http://www.stsci.edu).

The Wiki page mentioned is: http://wiki.apache.org/db-derby/DatabaseManager

On Dec 19, 2007 4:24 AM, John Embretsen <[EMAIL PROTECTED]> wrote:

> Donald McLean wrote:
> > On December 3rd, we went live with the first version of our software
> > that uses Derby and Hibernate for persistent storage. We have learned
> > quite a few things on this journey, some of which are reflected in the
> > implementation of DatabaseManager that is posted on the Wiki.
>
> Sounds good! May I ask who "we" are? And would you mind providing a link
> to the
> wiki page you mentioned?
>


Successful Delivery

2007-12-19 Thread Donald McLean
I just wanted to throw in a little "Rah! Rah!" here.

On December 3rd, we went live with the first version of our software that
uses Derby and Hibernate for persistent storage. We have learned quite a few
things on this journey, some of which are reflected in the implementation of
DatabaseManager that is posted on the Wiki.

Some of the more interesting lessons such as the mechanism we implemented to
update the database of our live application and how we handle multiple user
threads came afterwords. Unfortunately, I can't post that code (the version
of DatabaseManager on the Wiki was developed independently) however, if
anyone is interested, I might be talked into writing a short paper.

I would like to throw a big "thank you" to all of the Derby developers.
Without this product this delivery would probably have been much more
painful.

Donald McLean

P.S. The application is a tool used by astronomers who are preparing their
proposals for time on the Hubble Space Telescope.