Suppose I have a table called spitems with the following fields:
spitemid (unique key)
modifiedon (timestamp)
parentid
a number of other unsignificant fields
What I want to retrieve, is the spitem rows with the highest modifiedon day for each parentid.
However, be aware that the modifiedon timestamp is not unique, so it is possible ...
Back at Tech Ed in 2008, Microsoft announced that:
IBM and Microsoft have agreed to work together to integrate IBM DB2 database access with Visual Studio Team System Database Edition.
-- Microsoft Press Release - 6/3/2008
Has anyone seen evidence that this has actually happened? More importantly, has anyone had success moving DB...
I am using Hibernate with Spring and DB2. I am using sequences to generate primary key for entities. All entities use the same sequence HIBERNATE_SEQUENCE, which is the hibernate default.
The problem is that values that end up into primary keys are about 10 times higher than those returned by the HIBERNATE_SEQUENCE.
For example this si...
I am trying to introduce RoR to my company and I have two ways of doing so in my mind:
(1) rails/ibm_db2/passenger/DB2 - which is my preferable way but it is not really supported by company's infrastructure.
(2) jruby/activerecord-jdbc/tomcat/DB2 - probably easier way to migrate relying on current infrastructure and java libs IF I have...
We have db2 express-c x86_64 installed on Ubuntu Hardy (8.04). When I try to start the server, we see the following which we think is preventing db2 from acquiring port 50000 (nmap -sS -O 127.0.0.1 does not show db2):
$ . ~db2inst1/sqllib/db2profile
$ db2start
SQL5043N Support for one or more communications protocols failed to start su...
Hello Friends I need to write a funcation or Stroedprocedure in DB2 to do some types of calculations
here is my question:
I have table in DB2 from that table I need to pass two colums values to the Funcation ..
in this table One coulmn have four fields
ex: State is the Clumn name in that state there may be one city or more than one c...
This query is PAINFULLY slow and our team cannot figure out why. We've tried creating views, but it still extremely slow. Any thoughts?
SELECT
CI . CWARCASNBR AS CASENUMBER ,
CI . CT1FYA AS COURTAGENCYCODE ,
CI . CIPTYSQNBR AS PARTYSEQNBR ,
CI . CIRCDTYPE AS CASETYPECODE ,
CP . NMELASTBUS AS LASTNAME ,
CP...
When I run the following:
Session session = null;
Transaction tx = null;
List<Intake> intakes = null;
try{
session = sessionFactory.getCurrentSession();
tx = session.beginTransaction();
intakes = session.createQuery("from Intake i where i.assignedTo=?")
.setParameter(0, assignedTo)...
Hi im using sqlalchemy on a db2 table with 500k rows.
using plain sql like this:
sql="select * from test.test"
result=Session.execute(sql)
for row in result:
pdic[row.id]=row.val1
this takes 5min
if i use ibm_db :
sql="select * from test.test"
stmt = ibm_db.exec_immediate(ibm_db_conn,sql)
result =ibm_db.fetch_both(stmt)...
... for strings, it's easy... LENGTH(attribute), but for ints, LENGTH always returns "4" for ints, "8" for bigints, etc etc.
So given a statement like this:
create table EMPLOYEE (employeeno bigint NOT NULL PRIMARY KEY);
How could I add a CHECK clause that'll check to see whether an inserted employeeno is exactly 6 digits?
...
Using IBM DB2 database, I have a three relational tables:
Project: id, title, description
Topic: projectId, value
Tag: projectId, value
I need to produce the following XML file from the previous table:
<projects>
<project id="project1">
<title>title1</title>
<description>desc1</description>
...
I have slimmed down the query to remove potential complications, in addition I have verified that the fields are correct. DB2 UDB zSeries V7 is my db2 version.
SELECT
STDINSTRCD,
count(*) over(partition by STDINSTRCD),
CAST(STDINSTRDESC AS VARCHAR(1000)) AS INSTR,
C.STDINSTRSEQ,
1
FROM SYST.SCC004 C
WHERE C.STDINSTRCD = '098'...
Hi,
We are facing a problem in our application. We have two instances of our monitoring application. The application behaviour is as follows:
Step 1. Monitor the ftp folder in a loop
Step 2. If files are present, insert the file details to DB for the all files
Step 3. Read the file details from the DB and process it
Step 4. Once the fi...
Sorry if the title is confusing. Here is the query I have
Select MONTH(DATE(TIMESTAMP)), SUM(FIELD1), SUM(FIELD2) from TABLE WHERE TIMESTAMP BETWEEN '2009-07-26 00:00:00' AND '2010-02-24 23:59:59' GROUP BY MONTH(DATE(TIMESTAMP))
This will let me get the month number out of the query. The problem is that right now it is sorting the mon...
Hi,
doing profiling on an java application running websphere 7 and DB2 we can see that we spend most of our time in the com.ibm.ws.rsadapter.jdbc package handling connections to and from the database.
How can we tune our jdbc performance?
What other strategies exist when database performance is a bottleneck?
Thanks
...
Hi there,
I don't know why but hibernate tries to cast BigDecimal to one of my columns. This column is definied as Decimal(3,0) in my DB2 DB. So there can't be a BigDecimal.
hbm.xml
<composite-id name="Id" class="db2.P5Id">
....
<key-property name="land" type="int">
<column name="PFIELD1" precision="3"/>
</key-pro...
I would like to run some ad hoc select statements in the IBM System I Navigator tool for DB2 using a variable that I declare.
For example, in the SQL Server world I would easily do this in the SQL Server Management Studio query window like so:
DECLARE @VariableName varchar(50);
SET @VariableName = 'blah blah';
select * from TableName ...
I need to select unique codes and their sum(value) values. This does not work:
select distinct t1.code, (
select sum(t2.value) from table2 t2
where t2.code = t1.code
)
from table1 t1
example table:
Code Value
ABC 1
ABC 2
BCD 12345
expected:
Code Value
ABC 3
BCD 12345
actual:
Code Value
ABC (null)
BCD (null)
Thanks...
Simplifying, I produce a set of XML elements with a SQL query such as:
SELECT XMLELEMENT(NAME "project", project) FROM project;
<project>project1</project>
<project>project2</project>
...
Now I need to wrap this sequence into a main "projects" element, and output this in a nice indented XML file.
I've tried as follows:
db2 -x "SELEC...
This is a very easy query (I think) but I stil can't do it.
I have some data like this:
A B C
1 1100 5
1 1100 5
1 500 1
2 1200 4
2 1200 4
2 600 1
3 1300 3
3 1300 3
3 700 1
And I want to return the ...