Category: DB2
-
Some ETL (Extract-Transform-Load) tools for DB2
Withdata Software provide some ETL (Extract-Transform-Load) tools for DB2: FileToDB Load TXT, CSV, TSV, XML, JSON, Excel, SQL, RDF, INI data to DB2 DBToFile Export DB2 data to TXT, CSV, TSV, XML, JSON, Excel, SQL files DBCopier Copy data between DB2 and other rational databases MongoToDB Ease your MongoDB to DB2 converting work DBBlobEditor Edit…
-
How to get index column names of a table from DB2
select name,colnames from sysibm.sysindexes where tbname=’my_table_name’ See also: How to get index column names of a table from SQL Server How to get index column names of a table from MySQL How to get index column names of a table from PostgreSQL How to get index column names of a table from SQLite How to…
-
How to get primary key of a table from DB2
SELECT COLNAME FROM syscat.COLUMNS WHERE tabschema=’my_schema_name’ AND tabname=’my_table_name’ AND KEYSEQ=1 See also: How to get primary key of a table from PostgreSQL How to get primary key of a table from SQLite How to get primary key of a table from MySQL How to get primary key of a table from SQL Server How to…
-
About DB2 error “CLI0106E Connection is closed. SQLSTATE=08003”
Sometimes, you meet this error “”CLI0106E Connection is closed. SQLSTATE=08003” when you run DB2 tools. This error would be due to “The connection specified by the connection handle is no longer active.” You can add the following to your db2cli.ini file and restart the tool: QUERYTIMEOUTINTERVAL = 0 If you still meet this error, maybe…
-
About “Cannot load client library: db2cli.dll”
When you use DB2 tools that call DB2 client library “db2cli.dll”, you may meet this error: “Cannot load client library: db2cli.dll” You can download this tool to solve the problem: DB2_CLI_Setup_32.zip
-
About “Cannot load client library: db2cli64.dll”
When you use DB2 tools that call DB2 client library “db2cli64.dll”, you may meet this error: “Cannot load client library: db2cli64.dll” You can download this tool to solve the problem: DB2_CLI_Setup_64.zip
-
How to execute sql file via command line for DB2
You can save a .sql file to your hard drive, and execute it using the DB2 command line using: db2 -vtf C:\path\to\test.sql -v echoes the command text back to the command line -t sets the statement terminator to ;. -f tells the command line to load the commands from the file. See other command line options, http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.admin.cmd.doc/doc/r0010410.html. from: http://stackoverflow.com/questions/17834343/how-to-create-batch-file-to-execute-multiple-db2-queries
-
The DB2 equivalent for the MySQL Limit
In MySQL, you can use “Limit n,m”, like this: select * from sometable order by name limit 20,10 And in DB2, use this query: SELECT * FROM (SELECT * FROM sometable ORDER BY name DESC fetch first {start} rows only ) AS mini ORDER BY mini.name ASC fetch first {total} rows only SELECT * FROM…
-
Replace (Update/Insert) a row into DB2 table – Merge into
In MySQL, if you want to either updates or inserts a row in a table, depending if the table already has a row that matches the data, you can use “ON DUPLICATE KEY UPDATE”. How to do it in DB2? Use “merge into” . MERGE INTO table_to_upsert AS tab USING (VALUES (1, 2, 3), (4, 5,…
-
How to get column names from DB2 table
SELECT colname, typename, length, scale, default FROM syscat.columns WHERE tabname = “<table name>” AND tabschema = “<schema name>” See also: How to get column names from Sql Server table How to get column names from Oracle table How to get column names from Mysql table How to get column names from PostgreSQL table How to…