DB2

IBM DB2 is a family of relational database server products developed by IBM that have been extended to support object-relational features and non-relational structures like JSON and XML. There are three main products in the DB2 family: DB2 for Linux, UNIX and Windows (informally known as DB2 LUW), DB2 for z/OS (mainframe), and DB2 for i (formerly OS/400), plus a version for IBM's Virtual Storage Extended (VSE) operating system.

Share tech news, updates, or what's on your mind.

Sign up to Post

TABLE1
store_ID
Relation_ID
Store_Open
Store_Close
Trans_Date


TABLE2
Relation_ID
Relation_Name

TABLE3
Store_ID
Store_Name

TABLE1 is transactional, table 2 is static as is table 3
I need to find all the stores and their names from TABLE3 where the stores opened in 2016. Also all the names where they closed in 2017. But only for a Relation_Name = "MyStore"
I have a query that, without using the transaction dates, gives results, but I'm sure its wrong.  I need to only use the Max record previous to the end of 2016.
(I know the date syntax can change from platform to platform - this is for DB2, or oracle)

The query that almost works is:
Select distinct(A.Store_ID)
,A.Store_Name
from TABLE3 A
join TABLE2 B on A.Relation_ID= B.Relation_ID
join TABLE3 C on A.Store_ID = B.Store_ID
where B.Relation_Name = "MyStore"
and C.Store_Open < '01/01/2017'
and C.Store_Close > '01/01/2017'

How do I only use the Max records of TABLE1 in 2016?
0
Get expert help—faster!
LVL 12
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Hi Experts,

Is there any way to compare 2 timestamp and pull records from DB2 using query.

 Query wil be having input file which contains basic timestamp .We have to compare this timestamp with the timestamp in process_date column and have to pull all records which happend after this basic timestamp.

How to compare timestamps and pull records ...

Any help regarding this would be helpful.

Thanks in Advance.
0
One of our developers is attempting to do an "Insert" into a view.  They are connecting in via ODBC.

I gave the user profile *ALL authority to the View but I am getting the error:

Message: [SQL0551] Not authorized to object VSTOWERINT in DCTEST type *FILE. Cause . . . . . :   An operation was attempted on object VSTOWERINT in DCTEST type *FILE.  This operation cannot be performed without the required authority. Recovery  . . . :   Obtain the required authority from either the security officer, the object owner, or a user that is authorized to the QIBM_DB_SECADM function. If you are not authorized to a logical file, obtain the authority to the based-on files of the logical file. Try the operation again.   Processing ended because the highlighted statement did not complete successfully

I figured I needed to give the user access to the file that the view was based on...but I gave the user *ALL access to this file too and we are still getting the same error.

Does anyone have any insight into why we would be getting this error - even though we gave the user *ALL access?

Thanks in advance
0
Hi,

Can anyone advice what is the command to check for total user mailbox and size?

eg.
Sum up
DB1 => 500 Users Mailbox and 300GB
DB2 => 1000 Users Mailbox and 400GB

Tks

Lucky
0
Hi Experts,

Good Day

As per my work , I need to write a DB2 sql query which has to pull records after a specific timestamp..Already in the table there is a column for timestamp(transaction_date). So basically It should compare with this column value and If the transaction-date timestamp is greater than the specific time stamp , It should pull those records.

Specific timestamp will be present inside a text file(/home/user/inputpath/Extracted-date.txt).
How can I write query? input should be taken from the text file and compare with the transaction-date timestamp.

select query where 

Open in new window

Thanks in Advance.
0
Hi,

Right now want to research about how vulnerability each major DB has :

1) MS SQL
2) MySQL
3) MariaDB
4) Oracle
5) DB2.

Other than NIST database : https://nvd.nist.gov/vuln/search.

What other source I can search on the number of vulnerability of each product in last 3 years and the result make sense ?  the source has to be trust able !
0
SELECT UPPER(COLUMN1)
FROM SCHEMA1.TABLE1

SELECT UPPER(COLUMN2)
FROM SCHEMA2.TABLE2

i have 100 records in column 1 and column 2 with roughly half capitol words(HONDA etc.) and rest of half small words(nissan etc.)

when i do UPPER character function

i expected to see 50 records with values like NISSAN


when i do LOWER character function
i expected to see 50 records with values like honda

but i got only 2 records.

can you please advise how to fix this
0
I want to export data from Mainframe DB2 to Excel through VBA. I am not able to establish connection through following connection string.


Set con = CreateObject("adodb.connection")
Set mrs = CreateObject("adodb.recordset")

With Sheets("Sheet1")

con.Open "Driver={IBM DB2 ODBC DRIVER};Database=<dbname>;Hostname=<hostname>;Port=1433;Protocol=TCPIP;Uid=user;Pwd=password;"

Its giving run time error for data source not found and no default driver installed.
0
hi,

what kind of encryption DB2 is offering? what tier are they doing to protect?
0
hi,

for DB2, any feature/way to move all DB2 files on RAM , not just logical table / objects?
0
Cloud Class® Course: Python 3 Fundamentals
LVL 12
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

hi,

Automatic storage management is only logical structure only and not related to what oracle ASM can offer, it can't load balancing data based on need, right?

also any limitation on using that ?
0
Hi Team,

According to my work, I have to run 7000+ sql statements in DB2 .I have the java code of the same.But by default DB2 java can only run 1338 dynamic statements at one time.
So what I was doing that Split the input data (7000 + ) into mulitiple txt files and run program more than 7 times .Each time I have to change the input path file.

Now  instead of running program 7+ times and manually changing input path everytime,I m trying to dynamically read all the input files from that folder.
Here I am attaching a part of my program only..only the method to read input file.
Below is the code for single input file case. Assume I have files named as a.txt,b.txt,c.txt.....etc.
Text file contains data in the below format:-
----------------------
abc-465747        
dfr-756372
---------------------
Existing code which executes fine  for single input file

declared input file path
static String fileName="C:\\Users\\john\\Desktop\\policies.txt";

Open in new window


main method.
 public static void main(String[] args)
        
    {
    Pre pd = new Pre();
   
      
    pd.read_Policy_list_file(fileNames);

//other methods as a part of my work
}

Open in new window


read+policy method
public void read_Policy_list_file (String fileName)
		{
			try
			{
				BufferedReader br = new BufferedReader(new FileReader(fileName));
				try {
				    StringBuilder sb = new StringBuilder();
				    String line = br.readLine();

				    while (line != null) 
				    {
				    
				

Open in new window

0
Hi ALL

Good Morning.

I am facing problem with DB2 Federation. I am doing between 10.5 and 9.7 .

create server servername type db2/udb version '9.7' wrapper DRDA authid "db2inst1"  password "password" options(add dbname 'DBNAME');


create user mapping for sourceinstancename server servername options ( remote_authid 'db2inst1', remote_password 'password');

Any iputs please..
0
hi,

Anyone know how many effort /steps to migrate from Oracle 10g to DB2?

We have Oracle platform composite of :

1) Oracle application server.
2) Oracle OLAP server
3) Oracle BI server
4) Oracle BI answer.
5) Oracle database server.

Our code is build upon on java, ActiveX and VBA.
0
hi,

what kind of DB2 Geographic Replication solution we can have?
0
Hello,

I am attempting to add two date paramaters to an existing query using a "between" clause like this:

AND TIMES.ADMINISTERED_TIME between '2017-01-01' and '2018-01-01'

Open in new window


The problem is that this part seems to get ignored (doesn't change the results of the query) when added.  

I do not receive any errors and I have tried various ways of referencing the ADMINISTERED_TIME field with not avail.

The following query (for testing) works as expected:

SELECT * FROM  ORDER_MED_ADMIN_TIMES WHERE ADMINISTERED_TIME BETWEEN '2017-01-01' AND '2018-01-01'

Open in new window


Here is the entire query where the date between clause has no effect:

SELECT
DISTINCT 
ORD.CLIENTID ||' '|| TRIM(CLTLST)||', '||TRIM(CLTFST) AS CLIENT
, Case when varchar_format (stopdatetime, 'YYYY-MM-DD HH24:MI') >= varchar_format (I.CHANGESTAMP, 'YYYY-MM-DD HH24:MI') then 'discharged' else ORD.STATUS end as STATUS
,UPPER(BRAND_NAME) AS TEST
,TRIM(BRAND_NAME)||' ('||TRIM(GENERIC_NAME)||') '||TRIM(STRENGTH) AS MEDICATION
,TRIM(SIG_ACTION)||' '|| TRIM(SIG_DOSE)||' '|| TRIM(SIG_DOSE_UNIT)||' '|| TRIM(SIG_ROUTE)||' '|| TRIM(SIG_DOSE_TIMING)||' '|| TRIM(SIG_DOSE_OTHER)||' '|| TRIM(SIG_DOSE_OTHER) AS SIG
, DATE(SCHEDULEDSTARTDT) AS START_DATE
, DATE(SCHEDULEDENDDT) AS END_DATE
, DATE(I.DISCHARGEDATE) as INPATIENT_DISCHARGE
,TRIM(INSTRUCTIONS) AS INSTRUCTION
,TRIM(STAFF.SMMLNM) ||', '|| TRIM(STAFF.SMMFNM) AS ORDERING_STAFF
,TRIM(STAFF2.SMMLNM) ||', '|| TRIM(STAFF2.SMMFNM) AS 

Open in new window

0
hi,

I am comparing major DB concurrent connection limit, what is the max concurrent connection MariaDB and DB2 can accept ?
0
hi,

I am now worrying about the programming support of DB2 database programming language, you know MySQL's programming language is so bad and the error message return from MySQL always misleading, is the error message return by DB2 meaningful and DB2 DBA easy to debug it ?

what is the name of the DB2 DB programming language btw ?
0
hi,

any Hadoop to DB2 gateway/proxy scaleoutable solution for DB2?
0
Cloud Class® Course: Microsoft Exchange Server
LVL 12
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

hi,

Did you all experienced any kind of DB2 file corruption on unix/linux OS?
0
hi,

any one has any report on the Least vulnerability database report, which one give the Least vulnerability ?
0
hi,

What cloud solution, DB2 can run well on ? RDS from amazon ?

has to offer good support.
0
hi,

after move to cloud, what clouded Db2 debug solution offer.

have to be help to dig out deep level query problem. e.g, which part of query has problem/slow the whole thing down.
0
hi,

how to montioring to DB2 over the cloud.
0
hi,

how DB2 work with MongoDB ?
0

DB2

IBM DB2 is a family of relational database server products developed by IBM that have been extended to support object-relational features and non-relational structures like JSON and XML. There are three main products in the DB2 family: DB2 for Linux, UNIX and Windows (informally known as DB2 LUW), DB2 for z/OS (mainframe), and DB2 for i (formerly OS/400), plus a version for IBM's Virtual Storage Extended (VSE) operating system.