db2

divide drops remainder in DB2 SQL

So I'm dividing an integer by a decimal, and storing the result in a decimal column. However, it always drops the fractional component(the part after the decimal point). If I multiply the result by 10 or 100 I get a more accurate result, but dividing again drops the fractional part again. The two fields I've inserted into were a precisi...

Using 4-part naming to do insert to DB2 from SQL Server 2005?

Hello, We're using DB2 9.1 on Linux and SQL Server 2005, and the IBM db2 odbc driver. We have a linked server set up to DB2. From SQL Server, I can do the following: -- I can create the new table fine exec ('create table dev.TestSylviaB (field1 int) in TS_DEV_USER_XXXX') at LinkDB2 -- I can use 4 part naming to select from it, as lo...

Detecting a -301 DB2 error in .NET

I have an application in VB.NET which is generating some -301 errors in DB2 on an update statement using an ADO.NET connection. It appears that DB2 reports the occurrence of this error, but then fixes whatever data was wrong and resubmits. This fixing and resubmission comes with additional overhead and in turn real dollars and cents cos...

Which Unix flavour do I need? J2EE application using IBM tools?

I want to try Unix for developing J2EE application. I use the IBM software. WASCE as application server DB2 Express-C as database. Eclipse Which Unix flavour will be most suitable for me? ...

Db2: no available conversion for the source page

I'm usind db2 8. Try to connect to the database (on the remotee computer, using vpn). While connecting I have an error: SQL0332N There is no available conversion for the source code page "1251" to the target code page "UNKNOWN". Reason Code "1". SQLSTATE=57017 I tried to set DISABLEUNICODE=1 in db2cli.ini, and aslo tried to set db2...

SQL CASE WHEN Recurring expression in case clause

my query: SELECT CASE WHEN DAYS(DATE( SUBSTR(DIGITS(STOCK_MONTH),5,4) CONCAT '-' CONCAT SUBSTR(DIGITS(STOCK_MONTH),9,2) CONCAT '-01') - 1 DAY + 1 MONTH) - DAYS(HUB_ARRIVAL_DT) < 31 THEN ' 030' WHEN DAYS(DATE( SUBSTR(DIGITS(STOCK_MONTH),5,4) CONCAT '-' CONCAT SUBSTR(DIGITS(STOCK_MONTH),9,2) CONCAT '-01') - 1 DAY + 1 MONTH) - DAY...

Integrity control of DB2 query over network

Is there a way to control the integrity of a DB2 query/response between Websphere 6.1 and DB2 8.1 ? I know there is a SecurityMechanism usuable with the JDBC UDB Type 4 driver to encrypt password and data. Is there something similar for integrity ? ...

Hibernate NullPointerException In Loader Class

I'm having a bit of an odd problem. This is Hibernate 3.3.2-GA with DB2400Dialect. I'm seeing the following exception -- java.lang.NullPointerException at org.hibernate.loader.Loader.doQuery(Loader.java:720) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) at org.hibernate.loader.Loader.doList(Loa...

What should be the correct/better approach for locking a record in table?

Actually, the problem is like this:- i am having a table, say Payments. I have provided few GUI for searching, viewing and editing the record. Now if the user is trying to edit a record perform some particular action, which takes say 1 minute to process. Then another user should not be able to perform that particular operation on the sam...

how to delete one of the two duplicate records in db2 database.

I have a requirement where i have two records with same value except the PK. how can i delete one of them.I have plenty of such duplicate records. ...

How do I combine two queries (union all) into one row?

I have a tricky situation in trying to get information from multiple queries into a single row. Consider the following table: CpuUage: Time time Group char(10) Subsys char(4) Jobs int Cpu int holding the following data: Time Group Subsys Jobs Cpu ----- ------ ------ ---- --- 00:00 group1 ...

Connecting to DB2 through PHP

I'm trying to connect to a DB2 databse from a windows machine using XAMPP. When I try to load the php_ibm_db2 module I get the following error "PHP Startup: ibm_db2: Unable to initialize module Module compiled with module API=20060613 PHP compiled with module API=20090626 These options need to match" How do I fix this and connect t...

Datasource creation in JBOSS for DB2

How JBOSS uses db2-ds.xml file to create datasource object for DB2? ...

Connecting to commercial databases from an Adobe AIR application

I'm new to Flex and Adobe AIR, but I'm writing a desktop application that will need to connect and query commercial databases such as DB2, SQL Server and Oracle. How do I connect to these type of databases from ActionScript in an AIR application? ...

Rotate table DB2 SQL

I have a small table, one row, three columns. I need it to be one column three rows. Thanks, Buzkie ...

db2 can't connect from clients after restart

Hi I stopped my db using db2stop force. The started did a backup restarted and after that i cannot connect to db from the a client anymore i get: using the command db2 connect to "dbname" using "user" SQL30082N Security processing failed with reason "42" ("ROOT CAPABILITY REQUIRED"). SQLSTATE=08001 password and userna...

db2 security issue

hi, I tried this from a client: connect to db from shell with a random user like this db2 connect to remotenode no user or using ... then i m logged in and can do db2 describe tables for schema xxx I m not allowed to query any tables . thank god . How can i prevent this? anyone can browse the tables ...

Math with previous row in SQL, avoiding nested queries ?

Hi, I want to do some math on the previous rows in an SQL request in order to avoid doing it in my code. I have a table representing the sales of two entities (the data represented here is doesn't make much sense and it's just an excerpt) : YEAR ID SALES PURCHASE MARGIN 2009 1 10796820,57 266...

Trying to avoid -803 in DB2 insert

I'm trying to insert a single row which may or may not already exist. I'd like to avoid selecting it first and/or getting a -803 if it does exist. I've done some research and tried both ignore and the merge statement, but keep getting syntax errors on both. In any case, I'm not trying copy the data from another table - so, merge is no...

Db2 9 throwing InvalidDataAccessResourceUsageException instead of PermissionDeniedDataAccessException

I have a Java application which queries a database table which the current user account may or may not have access to. If an exception is returned, I would like to distinguish between AccessDenied and the database server being down/offline. I expected that db2 would throw a PermissionDeniedDataAccessException when the user does not have ...