derby

conditional statements in derby

It looks like derby doesn't support conditional statements [IF]. How do we write if exists (select 1 from customers where name='somename') update customers ... else insert into customers ... in derby? Derby doesn't have 'replace into' of mysql either. Note: I am using derby as unit-testing replacement for mysql [that is pr...

mixing basic DataSource with connection pooling DataSource: when to call close()?

I'm in the process of adding connection pooling to our java app. The app can work with different rdbmses, and both as a desktop app and as a headless webservice. The basic implementation works fine in desktop mode (rdbms = derby). When running as a webservice (rdbms = mysql), we see that connection pooling is needed to get good concurr...

How to connect Derby Database with Servlet?

Hi, I have never connect a database in java before. May I know should I go about accessing a derby database with servlet? I have checked out this: How do I access a database from my servlet or JSP? But I saw comments on the article saying that this is a bad way to connect. Could any one explain or show me the best way to that I should ...

How to get the hour difference between 2 datetimestamp on derby db?

Hi, I have a sql question on derby database: Select a.name, a.starttime, a.endtime From a How can I add to the above sql statement such that I can get the difference in hours between the start time and end time? (I only know that for mysql there is a DATEDIFF function, but I am not sure about what function should I use for derby db) ...

Error in getting Date input form user and storing in database using JSF

I am developing a web application based on JSF technology. I use Eclipse as the IDE and using Apache Derby as a database. When getting user input, I have one of the fields as a date field, i.e, Date of Birth. But when I update the database table, I get error report. Date Of Birth: <h:inputText value="#{employeeBean.dob}"> <f:convert...

How to Get Primary Key and Unique Constraint Columns in Derby

How does one do this? The SYSCOLUMNS system table only has columns for tables. SYSCHECKS has a REFERENCEDCOLUMNS object. Is there any way to get this. I'm aware of the JDBC getPrimaryKeys call, but that doesn't get unique constraint columns. ...

How to alter a column datatype for derby database?

Hi, I am trying to alter a datatype for a derby db column. The current price column is set as DECIMAL(5,0). I would like to alter it to DECIMAL(7,2). I did this : alter table item alter column price set data type DECIMAL(7,2); But it did not work, and showing the error: Error: Only columns of type VARCHAR may have their length alte...

What to keep alive and what to recreate in a simple embedded database?

In a desktop application with an embedded Derby database, what should I keep alive (as opposed to recreating each time when talking with the database) for the whole lifetime of the application? Connection and Statement, using the same statement throughout the lifetime of the program? Connection, recreating statement repeatedly? Neither...

How to setup Replication or Federation between MySQL and Derby?

Perhaps this is not possible yet, but... What's the easiest way to setup Replication or Federation between MySQL and Derby? I need a way for data updates/inserts/deletes into a certain table in Derby to automatically flow into an equivalent identical table in MySQL, as quickly and efficiently as possible. This can be done in applicati...

php/derby "hello world"?

What's the code syntax, and what all do I need to install and configure, for invoking a Derby Stored Procedure (which is really Java code) from a PHP Script? ...

Help writing database queries for derby?

I have a database containing multiple tables (Person, Parents, etc) Person table has certain attributes particularly ssn, countryofbirth and currentcountry. Parents table has ssn, and fathersbirthcountry The ssn in Person is the same ssn in Parents - that is how they're linked. I'm trying to output the SSNs of all people who have the...

What is wrong with this database query?

I have the following tables in a database (i'll only list the important attributes): Person(ssn,countryofbirth) Parents(ssn,fatherbirthcountry) Employment(ssn, companyID) Company(companyID, name) My task is this: given fatherbirthcountry as input, output the names of companies where persons work whose countryofbirth match the fatherbi...

Jetspeed null PortletDefinition

Hello, I am running a jetspeed portal which contains various portlet applications and have come across an issue after a recent reinstall where some of the portlets will return Cannot pass a null PortletDefinition to a PortletEntity Any idea what is causing this issue? I investigated a bit and it seems that jetspeed runs a proce...

How to convert the time difference to hours(with 2 decimal place) in derby?

Hi, I am using timestampdiff in derby db to retrieve the time difference between 2 time: startdate, and enddate. e.g. startdate = 2010-02-23 02:59:52.045 enddate = 2010-02-23 03:45:39.898 select {fn timestampdiff(SQL_TSI_HOUR, startdate, enddate)} as diff I would like to know how can I get the time diff in hours, e.g. 0.25, etc? ...

Looking for some help with GWT/Derby in Eclipse

I'm attempting to learn AJAX via this site. I've made it down to the section where it says "you must put the code in the onModuleLoad()" (right above listing 4). I found two areas in my Eclipse project that mention onModuleLoad(): slicr.java and the actual EntryPoint.class file in the gwt-user.jar/com.google.gwt.core.client package. When...

Is NULL not allowed is SQL delete statement (for Derby)?

Hello Does anyone know why the following query fails in Derby? delete from MyTable where ((null = null) or (col1 = null)) OR ((102 = null) or (col2 = 102))) I get the following error: Error: Syntax error: Encountered "null" at line 3, column 3. SQLState: 42X01 ErrorCode: -1 The sql is being generated in a java program based on SQL...

What is the limit on number of columns in Oracle 10G and Derby Databases.

Until recently I thought limit on number of columns in Oracle DB was 255. But turns out the limit is 1000. Can someone confirm this? Also I was trying to find if there is any similar limit on number of columns in Derby DB, particularly embedded derby java DB ...

Apache Derby supports natively script delimiters?

Hello, I know that I could separate all statements by pre-cutting before their execution, but I have a case in which I would like to insert a series of statements in one execution, currently I receive the following error: Caused by: java.sql.SQLException: Syntax Error: Encountered ";" at line 2, column 33. at org.apache.derby.impl.j...

How to format a date using Apache Derby?

Hello, I would like to format nicely a date received from a query like: SELECT recdate FROM myrecords; pratically I am searching the function to pretty formatting with a date pattern, better if SimpleDateFormat like. And if not possible how can I build a class for formatting with somtehing like: SELECT MyFormatter(recdate) FROM myre...

Problem connecting to Apache Derby using Hibernate configuration file in Netbeans (ERROR XSDB6)

I've created a local Apache Derby database in Netbeans, but am having problems when I try and autogenerate the POJO files, using the "Hibernate Reverse Engineering Wizard". My Hibernate configuration (generated by Netbeans from the database connection, then I added a few bits): <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate...