db2

How to limit user access at database level in Hibernate

戏子无情 提交于 2019-12-21 04:46:10
问题 The App I need to implement a web app that will be used by different users. Each user has different privileges on various tables, e.g. User A can see fields 'name' and 'address' from the table Student User B can see fields 'name' and 'phone number', but not 'address' from the table Student User C can see and modify all fields mentioned above I will have something at the UI level to limit certain access, e.g. hide the "edit" button for users that don't have permission to modify entries.

Combinatorial Optimization Matching in SQL

半腔热情 提交于 2019-12-20 11:31:22
问题 I am having trouble developing a matching algorithm in SQL. I have one table subjects . Each of these needs to be matched to the same number of rows in the table controls (for the sake of this question let's say two rows or controls need to be selected for each subject). The location of the selected controls must match exactly, and the controls selected should have a value in match_field that is as close as possible to the subjects. Here is some sample data: Table subjects: id location match

Description of columns in a DB2 table

随声附和 提交于 2019-12-20 10:36:18
问题 How can we know the description of every column in a table(DB2) through SQL? My data base is DB2. 回答1: select tabname, colname, typename, length, scale, default, nulls, identity, generated, remarks, keyseq from syscat.columns 回答2: SELECT TABLE_CAT, TABLE_SCHEM, TABLE_NAME, COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_SIZE, COLUMN_TEXT FROM "SYSIBM"."SQLCOLUMNS" WHERE TABLE_SCHEM = 'SCHEMA' AND TABLE_NAME = 'TABLE' This is on DB2 V5R4, and is not a System Table but a SYSTEM VIEW . In case that

How to find substring inside a string (or how to grep a variable)? [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-20 08:57:49
问题 This question already has answers here : How to check if a string contains a substring in Bash (23 answers) Closed last year . I'm using BASH, and I don't know how to find a substring. It keeps failing, I've got a string (should this be an array?) Below, LIST is a string list of database names, SOURCE is the reply, one of those databases. The following still doesn't work: echo "******************************************************************" echo "* DB2 Offline Backup Script *" echo "*****

How to create multiple schema connections using Java?

天大地大妈咪最大 提交于 2019-12-20 07:40:00
问题 I have to work with two database: DB2 Oracle I have a schema in DB2 database named NAVID . I want to create the same schema with all tables in Oracle using Java. public class automateExport { static String value; public static void main(String[] args) throws SQLException, ClassNotFoundException { ResultSet rs = null; Connection DB2 = getConnection(); String sqlstm = "SELECT * FROM SYSCAT.COLUMNS WHERE TABSCHEMA NOT LIKE 'SYS%'"; PreparedStatement mainStmt = DB2.prepareStatement(sqlstm);

Top Group By DB2

自作多情 提交于 2019-12-20 05:26:13
问题 I've been trying for hours but can't get the query to do what I want using DB2. From table Company and Users I have the following tickets quantity info per company/user user company quantity ------------ ------------ ------------ mark nissan 300 tom toyota 50 steve krysler 80 mark ford 20 tom toyota 120 jose toyota 230 tom nissan 145 steve toyota 10 jose krysler 35 steve ford 100 This is generated by the query: SELECT T.USER, COUNT(T.USER) AS QUANTITY, T.COMPANY FROM TICKET T INNER JOIN

How to add explicit WHERE clause in Kafka Connect JDBC Source connector

大憨熊 提交于 2019-12-20 04:32:21
问题 I am using kafka connect to source data from DB2 to kafka topic and i am configuring sql query to read the data from DB2 , below is query SELECT SEQ_I AS error_id, TRIM(SEND_I) AS sca , to_char(CREATE_TS,'YYYY-MM-DD HH24:MI:SS.FF3') AS create_timestamp, CREATE_TS, TRIM(ERR_MSG) AS error_message , CASE substr(ERR_MSG,1,locate('-',ERR_MSG)-1) WHEN 'WARNING' THEN 'W' WHEN 'SUSPENDED' THEN 'F' END ERROR_TYPE FROM INTCHG_ERROR_DIR WHERE TRAN_I ='503' AND PRCS_N = 'GLOBAL' am using setting

How to add explicit WHERE clause in Kafka Connect JDBC Source connector

雨燕双飞 提交于 2019-12-20 04:32:13
问题 I am using kafka connect to source data from DB2 to kafka topic and i am configuring sql query to read the data from DB2 , below is query SELECT SEQ_I AS error_id, TRIM(SEND_I) AS sca , to_char(CREATE_TS,'YYYY-MM-DD HH24:MI:SS.FF3') AS create_timestamp, CREATE_TS, TRIM(ERR_MSG) AS error_message , CASE substr(ERR_MSG,1,locate('-',ERR_MSG)-1) WHEN 'WARNING' THEN 'W' WHEN 'SUSPENDED' THEN 'F' END ERROR_TYPE FROM INTCHG_ERROR_DIR WHERE TRAN_I ='503' AND PRCS_N = 'GLOBAL' am using setting

How to get difference from two timestamp in DB2?

余生颓废 提交于 2019-12-20 04:08:16
问题 i have a requirement in which i have to get time difference of two timestamp in hours and than later find an average of the hours. i am using below query to find difference of two timestamp but it does not give exact result it gives approx result. do we have any other solution to achieve the same.My two time stamps are as( LAST_MODIFIED_DATETIME - 2016-11-30 15:39:01.131 CREATE_DATETIME - 2016-07-01 17:25:52.375) select timestampdiff(8, char(LAST_MODIFIED_DATETIME-CREATE_DATETIME)) as total

DB2 query error during the retrieval of a CLOB field

北城余情 提交于 2019-12-20 03:43:15
问题 From Java I am doing the following query on DB2: SELECT * FROM PRV_PRE_ACTIVATION WHERE TRANSACTION_ID = ? The field TRANSACTION_ID is a VARCHAR of length 32. I set the parameter in the preparedStatement using the setString method. I get the error: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-270, SQLSTATE=42997, SQLERRMC=63, DRIVER=3.59.81 at com.ibm.db2.jcc.am.dd.a(dd.java:676) at com.ibm.db2.jcc.am.dd.a(dd.java:60) at com.ibm.db2.jcc.am.dd.a(dd.java:127) at com.ibm