Re: Using NetworkServerControl to access in-memory (only) tables of Embedded Derby

2010-02-16 Thread Kristian Waagan

On 16.02.10 03:02, Pavel Bortnovskiy wrote:

Bryan: thank you for your response.

I do see the thread you mention:

 Thread Group [derby.daemons]{10}(Daemon)
 Thread [derby.antiGC]{1}(Daemon)(WAITING)
 Thread [derby.rawStoreDaemon]{5}(Daemon)(TIMED_WAITING)
 Thread [derby.NetworkServerStarter]{5}(Daemon)(WAITING)
 Thread [NetworkServerThread_2]{5}(Daemon)(RUNNABLE)
 Thread [DRDAConnThread_3]{5}(Daemon)(WAITING)

However the behavior is still the same - if any other thread stops (for
instance in debugger), NetworkServerControl becomes unresponsive.
For instance, if I connect to it from the outside with another db app
(Aqua Data Studio, for instance), then connection to it breaks or the db
app can't access it.
But as soon as I let the thread run in that debugger, the connection
becomes alive and everything seems to work.

Has anyone else seen this kind of behavior?
Or perhaps, someone can share a piece of code (best practice) of how to
instantiate and run the NetworkServerControl, so that it's not
experiencing
such hang-ups.
   


Hi Pavel,

The code I'm about to post is by no means to be considered best 
practice, but I think it does what you want it to do. However, the code 
is basically yours :) (I copied it from your mail)
When I hit the breakpoint (set on the System.out.println in the static 
main method), the ping thread continued to run, and I could also access 
and do things with the database through ij.


Are you sure you're only stopping the current thread in your debugger?
When the system appears to hang, can you obtain a stack trace (using 
jstack or similar) and check what the Derby threads are doing?
Are you sure your stopped thread isn't holding on to some monitors / 
locks required by the other threads? (sounds unlikely, as the Derby 
threads should operate on their own, but I'm asking anyway...)


See the code I tested with below (I'm using localhost as host, so you 
cannot connect to Derby remotely).



Regards,
--
Kristian


import java.io.PrintWriter;
import java.net.InetAddress;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.derby.drda.NetworkServerControl;

public class ServerTestDebug implements Runnable {

private final InetAddress m_host;
private final int m_port = 1527;
private final AtomicBoolean m_done = new AtomicBoolean(false);
private final int m_sleep = 5000;

private NetworkServerControl m_server;

public ServerTestDebug()
throws Exception {
m_host = InetAddress.getByName(localhost);
}

  final public void start() throws Exception {
new Thread(this, Derby Server).start();
  }

  public void stop() {
  System.out.println(Telling server to stop...);
  m_done.set(true);
  }

  public void run() {
  try {
m_server = new NetworkServerControl(m_host, m_port);
m_server.start(new PrintWriter(System.out));
  } catch (Exception e) {
e.printStackTrace(System.out);
return;
  }

try {
  while (!m_done.get()) {
System.out.println(pinging...);
m_server.ping();

try {
  Thread.sleep(m_sleep);
} catch (InterruptedException e) {
  /* log */
}
  }
} catch (Exception e) {
  /* log - errror pinging server */
}
  try {
  System.out.println(Shutting down...);
m_server.shutdown();
  } catch (Exception e) {
  e.printStackTrace();
  }
  }

public static void main(String[] args)
throws Exception {
ServerTestDebug server = new ServerTestDebug();
server.start();
System.out.println(Starting main loop...);
int iterations = 30;
while (iterations  0) {
if (iterations == 20) {
   System.out.println(breakpoint here!);
}
try {
Thread.sleep(2000);
} catch (InterruptedException ie) { }
iterations--;
}
server.stop();
}
}






Much appreciated,

Pavel.











Bryan Pendletonbpendle...@amberpoint.com
02/05/2010 12:07 PM
Please respond to
Derby Discussionderby-user@db.apache.org


To
Derby Discussionderby-user@db.apache.org
cc

Subject
Re: Using NetworkServerControl to access in-memory (only) tables of
Embedded Derby






   

DerbyServer thread seems to still be running, yet the server is
unresponsive.
 

In addition to your own DerbyServer thread, which I don't think
actually *needs* to still be running, there should be a separate
thread which is started by the Derby network server code itself,
which has the job of accepting connections and delivering them
to other threads to be processed.

In my running network server, for example, when I look at the
threads that are active, I see:

NetworkServerThread_2 prio=6 tid=0x03044c80 nid=0x27c runnable
[0x033cf000..0x033cfae8]
  at 

Antwort: Re: NPE in JBitSet

2010-02-16 Thread Murat . Knecht
Hi Bryan,

thanks for the reply. I submitted the bug as #4549.

https://issues.apache.org/jira/browse/DERBY-4549

Regards,
Murat





Von:
Bryan Pendleton bpendle...@amberpoint.com
An:
Derby Discussion derby-user@db.apache.org
Datum:
16.02.2010 02:39
Betreff:
Re: NPE in JBitSet



 I'm getting a NPE with Derby 10.5.3.0. Is there a known workaround or 
 can I post this as a bug at JIRA?

Hi Murat,

I see the same problem with the current Derby trunk, so this seems
like a new bug to me. If you could post it as a bug at JIRA that would
be very much appreciated.

Please include your test case, and the Derby stack trace, just as you
did in your email; it was very clearly presented, thank you!

Regarding a workaround, I'm afraid I don't know of any. Something
has gone wrong in the data structures in the SQL compiler, but it will
take some study to figure out exactly what.

thanks,

bryan




Indexes on functions

2010-02-16 Thread Vrin26

Hello,

Is there a way to create index on functions in Derby?
I have a query as 'select emp_name, emp_addrs.from empTable where
UPPER(name) like ' SA%';
In Derby docs it's mentioned that indexes can be created only on column
names.
How can we achieve functional indexing in Derby?

Thanks.
-- 
View this message in context: 
http://old.nabble.com/Indexes-on-functions-tp27605852p27605852.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.



Re: Indexes on functions

2010-02-16 Thread Kristian Waagan

On 16.02.10 10:54, Vrin26 wrote:

Hello,

Is there a way to create index on functions in Derby?
I have a query as 'select emp_name, emp_addrs.from empTable where
UPPER(name) like ' SA%';
In Derby docs it's mentioned that indexes can be created only on column
names.
How can we achieve functional indexing in Derby?
   


Hello,

Would generated columns [1] satisfy your needs?

There is also some information recorded in DERBY-455 [2], but the 
proposed solution hasn't been implemented.



Regards,
--
Kristian

[1] http://blogs.sun.com/kah/entry/derby_10_5_preview_generated (see 
also the reference manual)

[2] https://issues.apache.org/jira/browse/DERBY-455


Thanks.
   




Re: Using IJ to copy data from one DB to an other one

2010-02-16 Thread Sylvain Leroux

Brett Wooldridge a écrit :

Sylvian,

If this is a one-time migration you might checkout the SQuirreL
client.  I think it has a cross-DB copy feature.

Brett




Thanks Brett.

I don't know SQuirreL. But it appears to be a graphical tool, isn't it? I was 
looking more to a script-based solution.


I posted a JIRA issue on this - and assign it to myself:
http://issues.apache.org/jira/browse/DERBY-4550


Sylvain

--
sylv...@chicoree.fr
http://www.chicoree.fr




common use case for data base programming not possible in derby?

2010-02-16 Thread Thomas
Okay thanks. The approach should work for me!

Note: although I would have preferred to

be able to accept data supplied for the normal columns (e.g. payload) and
silently have the system correct the tech columns (e.g. createdBy/On,
updatedBy/On) in case needed by overwriting user input

rather than

reject all input in case inproper values (incorrect username or timestamps too
far off) in the techcols are detected.





Embedded Connection fail when disconnected from Network ? Solaris

2010-02-16 Thread bruehlicke
Just want to check if some of you had the same experience.

I have my NetBeans based app with Embedded Derby. Now, I for fun
pulled out the network cable of my Solaris development box and it
fails to connect to the database. Doing the same on Windows works
(?read?Really strange)

Could still be a red herring - but if anyone had similar experience
(aka no connection to embedded Derby when disconnected from Network) -
let me know - in particular if you see the same on Solaris.

B-)


Re: Embedded Connection fail when disconnected from Network ? Solaris

2010-02-16 Thread bruehlicke
Igonore !!!   It turns out that you just have to WAIT much (much)
longer on Solaris to finally get the connection.

B-)

On Tue, Feb 16, 2010 at 10:17 AM, bruehlicke bruehli...@gmail.com wrote:
 Just want to check if some of you had the same experience.

 I have my NetBeans based app with Embedded Derby. Now, I for fun
 pulled out the network cable of my Solaris development box and it
 fails to connect to the database. Doing the same on Windows works
 (?read?Really strange)

 Could still be a red herring - but if anyone had similar experience
 (aka no connection to embedded Derby when disconnected from Network) -
 let me know - in particular if you see the same on Solaris.

 B-)



Re: Embedded Connection fail when disconnected from Network ? Solaris

2010-02-16 Thread bruehlicke
Wow - actually it is totally impossible to work with the Solaris
system if not hooked up to a network. Each query takes a hundred
years. - what's special about Solaris causing this ?

B-)

On Tue, Feb 16, 2010 at 10:34 AM, bruehlicke bruehli...@gmail.com wrote:
 Igonore !!!   It turns out that you just have to WAIT much (much)
 longer on Solaris to finally get the connection.

 B-)

 On Tue, Feb 16, 2010 at 10:17 AM, bruehlicke bruehli...@gmail.com wrote:
 Just want to check if some of you had the same experience.

 I have my NetBeans based app with Embedded Derby. Now, I for fun
 pulled out the network cable of my Solaris development box and it
 fails to connect to the database. Doing the same on Windows works
 (?read?Really strange)

 Could still be a red herring - but if anyone had similar experience
 (aka no connection to embedded Derby when disconnected from Network) -
 let me know - in particular if you see the same on Solaris.

 B-)




Re: Embedded Connection fail when disconnected from Network ? Solaris

2010-02-16 Thread Peter Ondruška
Dear B, actually this is Derby mailing list but I can tell you that
you should fix your nsswitch.conf not to use dns resolver (cp
/etc/nsswitch.files /etc/nsswitch.conf). Peter

On Tue, Feb 16, 2010 at 5:44 PM, bruehlicke bruehli...@gmail.com wrote:
 Wow - actually it is totally impossible to work with the Solaris
 system if not hooked up to a network. Each query takes a hundred
 years. - what's special about Solaris causing this ?

 B-)

 On Tue, Feb 16, 2010 at 10:34 AM, bruehlicke bruehli...@gmail.com wrote:
 Igonore !!!   It turns out that you just have to WAIT much (much)
 longer on Solaris to finally get the connection.

 B-)

 On Tue, Feb 16, 2010 at 10:17 AM, bruehlicke bruehli...@gmail.com wrote:
 Just want to check if some of you had the same experience.

 I have my NetBeans based app with Embedded Derby. Now, I for fun
 pulled out the network cable of my Solaris development box and it
 fails to connect to the database. Doing the same on Windows works
 (?read?Really strange)

 Could still be a red herring - but if anyone had similar experience
 (aka no connection to embedded Derby when disconnected from Network) -
 let me know - in particular if you see the same on Solaris.

 B-)





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

2010-02-16 Thread Dinesh Bajaj
I used ByteArrayOutputStream as you suggested, and the problem vanished. Thank 
you!!

-Dinesh

--- On Tue, 16/2/10, Dinesh Bajaj dinesh.ba...@ymail.com wrote:

From: Dinesh Bajaj dinesh.ba...@ymail.com
Subject: Re: 'ERROR 40XD0: Container has been closed.: java.io.IOException'.
To: Derby Discussion derby-user@db.apache.org
Date: Tuesday, 16 February, 2010, 10:16 AM


Hi Bryan,

Good idea. Having not worked much with streams before, this idea didn't strike 
me, or I was rather unaware about this possibility. I will try to implement 
this, and let you know whether this worked or not.

Thanks,
Dinesh
--- On Tue, 16/2/10, Bryan Pendleton bpendle...@amberpoint.com wrote:

From: Bryan Pendleton bpendle...@amberpoint.com
Subject: Re: 'ERROR 40XD0: Container has been closed.: java.io.IOException'.
To: Derby Discussion derby-user@db.apache.org
Date: Tuesday, 16 February, 2010, 7:17 AM

            ResultSet rs = con.createStatement().executeQuery(
           
          select * from TABLE1);
            rs.next();
            InputStream is = rs.getBinaryStream(1);
                    long length = rs.getBlob(1).length();
             rs.close();
 
             con.setAutoCommit(false);
             ps = con.prepareStatement(update table1 set photo = ?);
             ps.setBinaryStream(1, is, length);
             ps.executeUpdate();

I think it's problematic to try to hold on to the stream after
you've closed the ResultSet.

What happens if you read the stream fully into memory (say,
 by
copying it into a ByteArrayOutputStream), before closing the
result set, and then use your in-memory byte array to provide
the data for the update into the other table?

thanks,

bryan






   
The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.


  The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
http://in.yahoo.com/

Re: SQL Parser Code in Apache Derby Source Code

2010-02-16 Thread AKA_DERBY

Hello,

We are currently working on extracting the SQL Parser code from Apache Derby
Source Code. Can you please tell us in what form the parse tree is stored?
Where are the entry and exit points (file names) to the parser logic with
respect to the rest of the database.

Thanks in advance,
AKA

-- 
View this message in context: 
http://old.nabble.com/SQL-Parser-Code-in-Apache-Derby-Source-Code-tp27288345p27617836.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.