Re: CREATE FUNCTION with SQL examples ?

2004-12-17 Thread Suavi Ali Demir
Here is an example that behaves like the generate_unique() function of DB2: CREATE FUNCTION GENERATE_UNIQUE() RETURNS CHAR(13) FOR BIT DATA PARAMETER STYLE JAVA NO SQL LANGUAGE JAVA EXTERNAL NAME 'com.mycompany.MyClass.generate_unique'; Here is the corresponding java function in MyClass:

Re: CREATE FUNCTION with SQL examples ?

2004-12-17 Thread Suavi Ali Demir
Rajesh, do you not need to close your statement and result set objects in a try-finally block? rs.close and s1.close() would be needed, no? But you should NOT close the connection, right? Regards, Ali public static long returnBigInt() throws Exception { Connection conn =

Re: CREATE FUNCTION with SQL examples ?

2004-12-18 Thread Suavi Ali Demir
add try and catch here too, should you need } } Do let me know if it is otherwise -Rajesh Suavi Ali Demir wrote: Rajesh, do you not need to close your statement and result set objects in a try-finally block? rs.close and s1.close() would be needed, no? But you should

Re: CREATE FUNCTION with SQL examples ?

2004-12-18 Thread Suavi Ali Demir
Ali Demir wrote: Rajesh, do you not need to close your statement and result set objects in a try-finally block? rs.close and s1.close() would be needed, no? But you should NOT close the connection, right? Regards, Ali public static long returnBigInt() throws Exception

Re: CREATE FUNCTION with SQL examples ?

2004-12-18 Thread Suavi Ali Demir
connection in such cases, no? Regards, Ali --- Daniel John Debrunner [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Suavi Ali Demir wrote: To clarify: You shoul NOT close the connection that you get from the URL jdbc:default:connection. This is not a new

Re: Unable to create the second table in the SQL script

2004-12-28 Thread Suavi Ali Demir
Should the default value be a quoted string? 0 is probably not valid as a default value here. defaultpageid varchar(48) default 0 not null, Ali --- Nonick Me [EMAIL PROTECTED] wrote: I'm trying to run the following SQL script. The first table is created but not for the second table.

Re: identity column causes grief when populating table - suggestions?

2005-02-22 Thread Suavi Ali Demir
Will derby support default keyword as in: create table a( id int not null generated by DEFAULT as identity, ... or something like that? That would solve these problems as it would only generate values if we do not specify the value. Regards, Ali --- Trevor Squires [EMAIL PROTECTED] wrote:

Re: identity column causes grief when populating table - suggestions?

2005-02-22 Thread Suavi Ali Demir
The next import may be a table with foreign keys to the first one. Sometimes (most of the time actually) it is desireable to keep the original values in an identity column. Having to use generated always blocks many solutions including import/export, replication/sync where key space could be

Re: Using triggers and procedures?

2005-05-31 Thread Suavi Ali Demir
You may need to use it in a values clause in the trigger body: VALUES(APPBUT_USER.TRIGGER_RESIZE(schema,table)) Regards, Ali --- Peter Nabbefeld [EMAIL PROTECTED] wrote: Jean T. Anderson schrieb: A trigger can't call a procedure, but it can call a user-defined sql function. Could

Re: how to fetch specific number of rows?

2005-07-30 Thread Suavi Ali Demir
Hi Paulo, This asp page discusses different ways of doing what you want: http://www.aspfaq.com/show.asp?id=2120 One of the easy SQL ways discussed there is: To fetch 5 rows at a time and get the 3rd page you would use this sql: SELECT a.empno FROM employee a

Re: Unit tests with Derby DB

2005-09-14 Thread Suavi Ali Demir
After a shutdown=true, you should be able to connect to the same database again after doing aDriverManager.registerDriver( Class.forName(driverName).newInstance() ) Then, if the shutdown=true cleans up as you expect, that should work fine for you. Regards, SuaviLars Clausen [EMAIL PROTECTED]

Re: Unit tests with Derby DB

2005-09-14 Thread Suavi Ali Demir
Thanks for the clarification. Some applications might be actually registering the driver themselves. Whatare the problems that this might cause (if the app calls DriverManager.registerDriver() explicitly)? Regards, Suavi Daniel John Debrunner [EMAIL PROTECTED] wrote: Suavi Ali Demir wrote: After

Re: derby performance and 'order by'

2005-09-19 Thread Suavi Ali Demir
Actually, it sounds like the problem of finding top 1000 rows out of 166333 rows is different than sorting 166333 rows and maybe it could be optimized. There is no need to sort all 166333 but the information that we are only looking 1000 rows would have to be passed all the way down to the point

Re: derby performance and 'order by'

2005-09-19 Thread Suavi Ali Demir
thread cannot read the chunk structure whileanother is inserting a value into it... Come to think of it, it might run faster in single thread version when synchronization is not involved. Regards, Ali Daniel John Debrunner [EMAIL PROTECTED] wrote: Suavi Ali Demir wrote: Actually, it sounds like

Re: derby performance and 'order by'

2005-09-20 Thread Suavi Ali Demir
Another little detail about optimization is that Statement.setMaxRows() kind of functions on the JDBC side may not be sufficientsince it iscalled after SQL statement is prepared and returned as an object (after query plan is built). Therefore, it may be necessary to have language syntax to

Re: text datatype

2005-09-25 Thread Suavi Ali Demir
You can use varchar types and inside your saveDoc() function you can save the document in smaller chunksin multiple rows with an ORDERING column. Orcall it PAGE column. When you readDoc() you can assemble them back again. Table data will look like: DOCID TEXT PAGE 1"Hello " 1 1 "World." 22

Re: Tests in SQL

2005-09-30 Thread Suavi Ali Demir
SELECT CASE WHEN COL1 is NULL THEN0 ELSE1 END FROM MYTABLE Regards, AliNicolas Dufour [EMAIL PROTECTED] wrote: HelloI try to put tests in select clause.I mean I have a field which can be null and I want to create a select which return 0 when the field is null and 1 in the other case.Is it

Re: Trying to use UPDATE that needs more then one table for its WHERE clause

2005-10-31 Thread Suavi Ali Demir
update card set anythingyourwant where card.name in ( select c.namefrom edition as e, card_version as cv, card as c, edition as e2,session.load_card as lcwhere e.edition_id = cv.edition_id and c.card_id = cv.card_id and c.name = lc.name and c.card_id is not null and e.release_date

PreparedStatement.setBinaryStream(s,length)

2006-01-14 Thread Suavi Ali Demir
Hello,Does anybody know why the JDBC method: PreparedStatement.setBinaryStream(s,size)requires the caller to pass in the length of the stream?Regards, Ali

RE: embedded derby -- does it leak

2006-02-15 Thread Suavi Ali Demir
Hi Jim,How much memory did your colleagues start the JVM with when they evaluated Derby?Regards, AliJim Newsham [EMAIL PROTECTED] wrote: Rajesh,Thanks for the update on DERBY-756. Regarding DERBY-912, I recognize that it¡¯s a subtask of 756, nevertheless 756 is

Re: Derby Protocols

2006-05-20 Thread Suavi Ali Demir
derby:net is to connect to the network server, which could be running on another machine. ithas host:port to connect to. You start the derby network server and it runs as a database server to serve many clients.jdbc:derby:dbname is used to connect to a local database in embedded mode (derby

Re: equal query for derby select sysdate from dual in oracle

2006-06-09 Thread Suavi Ali Demir
Instead of "dual", in IBM lingo,i believe that table is calledSYSIBM.SYSDUMMY1. For example to test a connection you can use: SELECT 1 FROM SYSIBM.SYSDUMMY1or yours would be:SELECT CURRENT_TIMESTAMP FROM SYSIBM.SYSDUMMY1VALUES(1) would work in DB2/LUW butnot work in OS/390 for

Re: Iterate over big table...

2006-06-12 Thread Suavi Ali Demir
if it is a forward only cursor, when you do a select * and loop through all rows and doSomething() with each row (and not hold a reference tothe data yourself), there would be only 1 row's data in memory at a given time, no? (or few rows if Derby prefetches in chunks as you do rs.next()) [EMAIL

Re: Apache Derby (in the guise of Java DB) now shipping in Sun Java SE SDK

2006-06-16 Thread Suavi Ali Demir
Add a new column to the table, copy the data into new column, change your view (drop-create)to start using the new column and ignore the old column in the table. Ali Edson Carlos Ericksson Richter [EMAIL PROTECTED] wrote: Just curious, how could a view change datatype of one column?AFAIK, I can

RE: How to emulate multiple DISTINCT aggregates?

2006-08-28 Thread Suavi Ali Demir
That query needs to be modified little bit. It does notwork when my table contains:1 1 12 2 21 1 3result is 3,3,3, where as it should have been 2,2,3.This one works:SELECT (SELECT COUNT(DISTINCT b.field1) FROM table_a b) as field1_count, (SELECT

Re: GROUP_BY with user functions

2006-09-15 Thread Suavi Ali Demir
It seems you want all the repeating values next to each other? Would a sort help? Does order by work? Regards, Ali Robert Enyedi [EMAIL PROTECTED] wrote: Does Derby support user functions in GROUP BY clauses?I'm thinking of the following scenario:SELECT USER_FUNCTION(t1.column1)FROM TABLE

Re: Migrating a MySQL Database to Apache Derby

2007-08-13 Thread Suavi Ali Demir
export the mysql ddl and manually convert it to derby ddl. create the derby database schema from this ddl. export mysql tables into delimited text files. import data from text files. regards, ali Bryan Richardson [EMAIL PROTECTED] wrote: Hello all, Can anyone tell me how I can

Re: newbie question

2007-12-16 Thread Suavi Ali Demir
drop the table and ignore the does not exist error. regards, ali Brad Berens [EMAIL PROTECTED] wrote: I've googled for this but all I can find is create statements so I'm hoping someone can just give me a quick answer. I'm trying to write some db creation scripts. Normally in MSSQL I

Re: Double.NaN in table?

2007-12-18 Thread Suavi Ali Demir
By the way, while deciding whether a value x== Double.Nan or not, you probably cannot use == operator (may never be true). But if you compare string versions, they should equal (NaN). Ali Suavi Ali Demir [EMAIL PROTECTED] wrote: Can you make your column nullable and insert null instead

Re: Using derby as a chat server

2008-02-13 Thread Suavi Ali Demir
Have a table where you have 1 row that marks the relationship between two clients. Like a cartesian product: A, B A, C A, D B, A B, C B, D ..and so on. Have all clients have their dedicated connection acquire locks on these rows. Each lock represents a client that may

Re: java.lang.OutOfMemoryError

2008-02-13 Thread Suavi Ali Demir
How much memory do you give to your JVM? Ali John English [EMAIL PROTECTED] wrote: I have a table containing about 22000 records defined as follows: CREATE TABLE system_log ( id INTEGER GENERATED ALWAYS AS IDENTITY, time TIMESTAMP DEFAULT NULL, username VARCHAR(15), facility VARCHAR(15) NOT

Re: Starting Derby Server

2008-02-17 Thread Suavi Ali Demir
in derby's bin directory there is a startNetworkServer.bat regards, ali wotcha [EMAIL PROTECTED] wrote: Sorry if this has already been posted, but I'm a new Derby user. i've created an application using Netbeans 6.0 and embedded Derby DB - using the tutorial supplied by Netbeans - very

Re: top N reporting with derby

2008-05-13 Thread Suavi Ali Demir
If 100 is not absolute necessity, you can give datetime ranges. For example select 1 hour of logs at a time. Ali --- On Tue, 5/13/08, Matt Chambers [EMAIL PROTECTED] wrote: From: Matt Chambers [EMAIL PROTECTED]Subject: top N reporting with derbyTo: derby-user@db.apache.orgDate: Tuesday, May 13,

Re: any feedback on this?

2008-06-23 Thread Suavi Ali Demir
for case insensitive index, you can have another column that holds lower-case version of your original column. you can create an index on that lowercase column and use it in your sql. you can use triggers to maintain the lowercase column. ali --- On Mon, 6/23/08, Alan Burlison [EMAIL

Re: Derby problem: 13GB of space with 200000 records!

2008-09-11 Thread Suavi Ali Demir
Does the same happen if you use single thread? Does disk space use go down if you compress table? Should the word=word.trim().toLowerCase(); appear before setString? When you store the frequency of words, you would have records like: home, 1217 Then the number of rows would not exceed

Re: Relational database scalability

2008-10-12 Thread Suavi Ali Demir
Google App Engine does not seem to be using a relational database. It looks like a hashtable. Joins are not possible. In other words, yes some relational database functionality is not possible to be scalable at the prices Google offers. So Google does not provide a relational database. But this

Re: Most efficient way to get max row id?

2008-10-19 Thread Suavi Ali Demir
You should have an index. --- On Sun, 10/19/08, Amir Michail [EMAIL PROTECTED] wrote: From: Amir Michail [EMAIL PROTECTED] Subject: Re: Most efficient way to get max row id? To: Derby Discussion derby-user@db.apache.org Date: Sunday, October 19, 2008, 9:18 PM On Mon, Oct 20, 2008 at 12:15

Re: chinese text

2008-11-02 Thread Suavi Ali Demir
Insert the string value into the table. Language does not matter. Regards, Ali --- On Sun, 11/2/08, Graeme Henderson [EMAIL PROTECTED] wrote: From: Graeme Henderson [EMAIL PROTECTED] Subject: chinese text To: derby-user@db.apache.org Date: Sunday, November 2, 2008, 2:57 PM What is the

Re: DatabaseMetaData.getTables() resultset empty?

2008-11-09 Thread Suavi Ali Demir
Plz leave catalog as null. Ali --- On Sun, 11/9/08, Ole Ersoy [EMAIL PROTECTED] wrote: From: Ole Ersoy [EMAIL PROTECTED] Subject: Re: DatabaseMetaData.getTables() resultset empty? To: Derby Discussion derby-user@db.apache.org Date: Sunday, November 9, 2008, 8:29 PM Ali, I had percentage

Re: DatabaseMetaData.getTables() resultset empty?

2008-11-09 Thread Suavi Ali Demir
Try % instead of null. Ali --- On Sun, 11/9/08, Ole Ersoy [EMAIL PROTECTED] wrote: From: Ole Ersoy [EMAIL PROTECTED] Subject: Re: DatabaseMetaData.getTables() resultset empty? To: Derby Discussion derby-user@db.apache.org Date: Sunday, November 9, 2008, 8:12 PM Emmanuel, I gave it a go.

Re: Question about TableFunctions in Derby

2009-07-14 Thread Suavi Ali Demir
Try something like this: select house_number, street, city from table (legacy_realty_data('house_number, street, city where price 50')) then parse the string passed to your table function and implement a way to push down those predicates to your backend to only retrieve what is needed.