network server not shares access
Hi all, I wrote a little class, derived from NsSample.java in D:\db-derby-10.1.2.1-bin\demo\nserverdemo, that starts an embedded network server, than an embedded client, not embedded driver but org.apache.derby.jdbc.ClientDriver, to access the data provided by the network server , all togheter with my application within the same jvm. I supposed that the network server had the ability to share the data among different applications... but this seems not to be true cause I tried to start the ij utility to access to the same database, while my application is running, receiving these messages : ERROR XJ040: Failed to start database 'c:\ESQueryProd\derbyDB', see the next exception for details. ERROR XSDB6: Another instance of Derby may have already booted the database C:\ESQueryProd\derbyDB. Obviously, when I shut down my application, ij starts to run. I testes the same behavior in a network environment : I have a shared directory on a win 2k server with my application, and if I start it from 2 different clients, the first runs, while the second freezes until I shut down the first. Now I'd like to know how can I share the data in this scenario, is there any properties settings that allows my application to concurrentlu access the same db ? Any suggestions will be appreciated. Flavio PS I run with jvm 1.4.2_09 both win 2k win xp sp2 and derby 10.1.2.1 --- Il presente messaggio non costituisce un impegno contrattuale tra SILMA S.r.l. ed il destinatario. Le opinioni ivi espresse sono quelle dell'autore. SILMA S.r.l. non assume alcuna responsabilita riguardo al contenuto del presente messaggio. Il messaggio รจ destinato esclusivamente al destinatario. Il contenuto e gli allegati sono da considerarsi di natura confidenziale Nel caso abbiate ricevuto il presente messaggio per errore siete pregati di comunicarlo alla casella [EMAIL PROTECTED]
connection strange behavior
Hi all, I wrote a little class, derived from NsSample.java found in D:\db-derby-10.1.2.1-bin\demo\nserverdemo, to start an embedded server and use it with an embedded client (no embedded driver but org.apache.derby.jdbc.ClientDriver) fron within a java application, all in the same JVM. The first strange thing I found is that if I try to access the data with the ij utility while the application is running, I receive a messagge like this : ERROR XJ040: Failed to start database 'c:\ESQueryProd\derbyDB', see the next exception for details. ERROR XSDB6: Another instance of Derby may have already booted the database C:\ESQueryProd\derbyDB. Obviously, when I close the application everything goes fine. I thought that network server shares connection and data, but it seems not to be true. How can I do that ? I found the same behavior starting the application twice from newtwork : the first application starts correctly, the second freezes until I shut down the first. Thanks for any suggetion Flavio PS I run with jvm 1.4.2_09 with win XP sp2 and derby 10.1.2.1
Please try your applications with 10.2 optimizer changes
Army has been working hard to make lots of great optimizer improvements, most recently DERBY-781. For the vast majority of applications this should should show performance benefit, but there are risks any time optimizer changes are made and it would be a good idea to make sure that your app will run even faster with 10.2 and is not adversely affected. You may need to make adjustments for instance if you use Statements instead of PreparedStatements because compilation time may increase. Take a look at the DERBY-781 release note for details: https://issues.apache.org/jira/browse/DERBY-781#action_12421940 The DERBY-781 fix is not included with the latest snapshot, but you can get it with the latest unofficial builds that Ole posts at:: http://www.multinet.no/~solberg/public/Apache/Derby/builds/ Check the test results before your download. So please give your apps a try with 10.2 and record your results on this page: http://wiki.apache.org/db-derby/TenTwoApplicationTesting?highlight=%28TenTwoApplicationTesting%29 Trying 10.2 will also make you eligible for the Derby Regression Search and Destroy contest to be announced soon. Thanks Kathey
Re: connection strange behavior
Flavio Palumbo wrote: Hi all, I wrote a little class, derived from NsSample.java found in D:\db-derby-10.1.2.1-bin\demo\nserverdemo, to start an embedded server and use it with an embedded client (no embedded driver but org.apache.derby.jdbc.ClientDriver) fron within a java application, all in the same JVM. The first strange thing I found is that if I try to access the data with the ij utility while the application is running, I receive a messagge like this : ERROR XJ040: Failed to start database 'c:\ESQueryProd\derbyDB', see the next exception for details. ERROR XSDB6: Another instance of Derby may have already booted the database C:\ESQueryProd\derbyDB. Obviously, when I close the application everything goes fine. I thought that network server shares connection and data, but it seems not to be true. How can I do that ? Hello Flavio, If I understand you correctly, what you are trying to do should be possible. To make sure we are on the same page here, I have written a small application that creates two connections to a database: 1) I instruct Derby to start the NetworkServer by setting the property derby.drda.startNetworkServer = true. 2) The first connection creates the database 'testDB' using the embedded driver. The network server is also started now. 3) The second connection to 'testDB' is created by using the client driver. 4) I can connect to the same database using ij by specifying the following command (from ij): connect 'jdbc:derby://localhost/testDB'; Does this demonstrate what you are trying to to? You need to have the Derby jars in your classpath when running the application (and ij). Which exactly depends on your Derby version. I think there are variations on how to do this, and I'm sure people will let us know if there are easier/better ways to do it. If you have further questions, we'll try to answer them :) Regards, -- Kristian I found the same behavior starting the application twice from newtwork : the first application starts correctly, the second freezes until I shut down the first. Thanks for any suggetion Flavio PS I run with jvm 1.4.2_09 with win XP sp2 and derby 10.1.2.1 import java.sql.*; import java.io.BufferedReader; import java.io.InputStreamReader; public class DerbyServerInApp { public static void main(String[] args) throws Exception { // Inform Derby to start a networkserver. System.setProperty(derby.drda.startNetworkServer, true); // Load the drivers. You can get away with only one of them, byt we // use both here for demonstration. Class.forName(org.apache.derby.jdbc.EmbeddedDriver); Class.forName(org.apache.derby.jdbc.ClientDriver); // Connect and create a database. Connection con = DriverManager.getConnection( jdbc:derby:testDB;create=true); // Make sure the database is up before we connect with the // ClientDriver. try { Thread.currentThread().sleep(2000); } catch (InterruptedException ie) {} // Just loop and execute some queries. QueryThread qt1 = new QueryThread(con, 5000); QueryThread qt2 = new QueryThread( DriverManager.getConnection(jdbc:derby://localhost/testDB), 1000); // Wait until user press ENTER BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.println( PRESS ENTER TO STOP APPLICATION); qt1.start(); qt2.start(); in.readLine(); System.out.println(\n Please wait a little while :)); qt1.stop(); qt2.stop(); } } // End class DerbyServerInApp class QueryThread implements Runnable { private static int globalId = 0; private final Connection con; private final long interval; private final int id; private Thread thread = null; private volatile boolean doRun = false; public QueryThread(Connection con, long interval) { this.con = con; this.interval = interval; this.id = ++globalId; } public void run() { PreparedStatement ps; try { ps = con.prepareStatement(values ( + id + , CURRENT_TIME)); } catch (SQLException sqle) { sqle.printStackTrace(System.out); stop(); return; } ResultSet rs; while (doRun) { try { rs = ps.executeQuery(); rs.next(); System.out.println(rs.getInt(1) + :: + rs.getTime(2).toString()); rs.close(); } catch (SQLException sqle) { sqle.printStackTrace(System.out); stop(); } try { if (thread != null) { thread.sleep(interval); } } catch (InterruptedException ie) {} } //
Re: Please try your applications with 10.2 optimizer changes
Kathey Marsden wrote: The DERBY-781 fix is not included with the latest snapshot, but you can get it with the latest unofficial builds that Ole posts at:: http://www.multinet.no/~solberg/public/Apache/Derby/builds/ Actually, I don't think the DERBY-781 changes haven't been committed yet. They were reviewed and received a +1 to commit, but they haven't gone in yet. Similar situation for DERBY-1357... Users who are looking to try applications with the 10.2 changes might want to wait until *both* of those changes are checked in before running their tests... Army
Re: Please try your applications with 10.2 optimizer changes
Army wrote: Users who are looking to try applications with the 10.2 changes might want to wait until *both* of those changes are checked in before running their tests... Or try now and when the DERBY-781 changes are committed. The earlier the feedback the better chance of it being addressed in 10.2 release. Dan.
Re: Please try your applications with 10.2 optimizer changes
Daniel John Debrunner wrote: Or try now and when the DERBY-781 changes are committed. The earlier the feedback the better chance of it being addressed in 10.2 release. Yes, definitely worth testing now. There has been a great deal of code change in the past year that might affect users. The optimizer changes are one area but there are lots of others too. Exceptions have changed significantly in the client. With the introduction of JDBC 4.0, I am guessing DatabaseMetaData and ResultSetMetaData are high risk areas for any application that depends on them. Also I think that LOBS are another area were folks should definitely test after significant changes like DERBY-326/DERBY-721. Our known list of changes that may affect existing applications is at: http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=truepid=10594customfield_12310090=Existing+Application+Impactsorter/field=issuekeysorter/order=ASCsorter/field=updatedsorter/order=DESCsorter/field=prioritysorter/order=DESCrg/jira/secure/ConfigureReport.jspa?filterid=12310892 I have not done a complete pass of the changes and think there are probably more. One interesting thing to look at to identify other risk areas is the results of running the 10.1 tests against 10.2. Just by scanning the new output you might spot something that will affect your app. You can see these test results at: http://people.apache.org/~kmarsden/10_1_tests_10_2_derby/ For example in connectionJdbc20 you can see the new exception for DERBY-721. *** Start: connectionJdbc20 jdk1.4.2_07 DerbyNetClient derbynetmats:jdbc20 2006-06-27 00:44:04 *** 2a3,5 java.sql.SQLException: Stream of column value in result cannot be retrieved twice Kathey
10.2.0.4 snapshot available
I have generated a new 10.2 snapshot, which rolls up improvements that accumulated over the last month. Please test-drive it. You can download the snapshot from http://db.apache.org/derby/derby_downloads.html#Snapshot+Jars. For more information, see the wiki page describing the snapshot: http://wiki.apache.org/db-derby/TenTwoSnapshot. Regards, -Rick
Paginating result sets
I need some help figuring how to paginate result sets with Derby. Ihave scanned the list archives and have found one similar thread that never received a complete answer from May 2005. From what I understand this pagination behavior is possible in MySQL by using the 'LIMIT' query. This will allow me to select the first 100 rows, the second 100 rows, or any arbitrary chunk of rows that may be part of the result set. I understand that Derby does not support the LIMIT query. I also understand that the JDBC Statement class has two methods that are related (setFetchSize() and setMaxRows()), but they do not support the pagination behavior I desire. So let's say that a given SELECT statement will return 1000 rows. How do I create a SELECT statement that will only return me rows 600 - 699? Having spent a lot of time searching through Derby docs I have concluded that this is not possible in Derby, but I am hoping I am wrong. Does anyone know how to do this, or do I have to continue my search for an embedded database that supports LIMIT? Thanks, -John The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [EMAIL PROTECTED] - and destroy all copies of this information, including any attachments, without reading or disclosing them. Thank you.
Re: Paginating result sets
Did you try to use a scrollable cursor? Or how about storing your result set in to a temp table with some sort of row id? Both of these solutions are pretty much database independent, assuming of course that they support the concept of cursors... If you're going to use either solution, you're also going to need to consider what happens when you time out the user and you need to free up resources. HTH -G On Wednesday 19 July 2006 1:24 pm, Fantry, John wrote: I need some help figuring how to paginate result sets with Derby. I have scanned the list archives and have found one similar thread that never received a complete answer from May 2005. From what I understand this pagination behavior is possible in MySQL by using the 'LIMIT' query. This will allow me to select the first 100 rows, the second 100 rows, or any arbitrary chunk of rows that may be part of the result set. I understand that Derby does not support the LIMIT query. I also understand that the JDBC Statement class has two methods that are related (setFetchSize() and setMaxRows()), but they do not support the pagination behavior I desire. So let's say that a given SELECT statement will return 1000 rows. How do I create a SELECT statement that will only return me rows 600 - 699? Having spent a lot of time searching through Derby docs I have concluded that this is not possible in Derby, but I am hoping I am wrong. Does anyone know how to do this, or do I have to continue my search for an embedded database that supports LIMIT? Thanks, -John The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [EMAIL PROTECTED] - and destroy all copies of this information, including any attachments, without reading or disclosing them. Thank you. -- -- Michael Segel Principal Michael Segel Consulting Corp. [EMAIL PROTECTED] (312) 952-8175 [mobile]
Running JDO TCK using derby 10.2.0.4 snapshot w/o problems
Hi, I downloaded the 10.2.0.4 snapshot from http://db.apache.org/derby/derby_downloads.html#Snapshot+Jars as announced by Rick. I could successfully run the JDO 2.0 RI against the official JDO 2.0 TCK using the 10.2.0.4 version as underlying datastore implementation. Regards Michael -- Michael Bouschen[EMAIL PROTECTED] Engineering GmbH mailto:[EMAIL PROTECTED]http://www.tech.spree.de/ Tel.:++49/30/235 520-33 Buelowstr. 66 Fax.:++49/30/2175 2012 D-10783 Berlin