Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all 13329 articles
Browse latest View live

com.mysql.jdbc.exceptions.jdbc4.CommunicationsExce ption

$
0
0
com.mysql.jdbc.exceptions.jdbc4.CommunicationsExce ption: The last packet successfully received from the server was276150 seconds ago.The last packet sent successfully to the server was 276150 seconds ago, which is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

This exception is coming while logging into the application for the first time in a day. Have given the 'autoReconnect=true' option in context.xml of the application.

Socket Exception after 8 hours Idle time in Tomact6 + mysql + Java

$
0
0
Below exception is getting hen trying to access the application after 8 hours Idle time in Tomcat6 + mysql + java:

com.mysql.jdbc.exceptions.jdbc4.CommunicationsExce ption: The last packet successfully received from the server was276150 seconds ago.The last packet sent successfully to the server was 276150 seconds ago, which is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

Please suggest if faced similar issues

the particular research workers because

$
0
0
Hello yaarYet Wan’s art work powering the particular digital camera features increased due to the fact Hazardous which itself had been some sort of cycle way up from the severe as well as quite chronic rage associated with Saw. Your Conjuring examines the particular Perron house via extended calls for usually that has a limited visual standpoint photos which mimic the two inhabitants’ inabiility to check clear of so they can see precisely what is annoying them. Your fluid camerawork furthermore supplies deft visible exposition. A long keeping track of considered from the property with switching day time offers each good friend as well as a stitched-together 360-degree considered practices the particular research workers because they go walking from the property bothersome one particular place following another.

Download Enough Said | Download Riddick | Download Kick Ass 2 | Download The Conjuring | Download Mortal instruments City OF Bones | Website Development In Mohali | Website Development In Chandigarh

Create USER / DBMS Postgres 9.1

$
0
0
Running on Postgres 9.1 Ubuntu 13.04.
New to Postgres, not to DBMS.

Also trying to see if there is a list of system defined privileges that I can refer to, such as in Oracle.

I log in as Postgres user: psql -h localhost -U postgres
and then I create a db and user and allow grants to the user like this:

create user import_dbms_user with password 'import_dbms';
create database import_dbms_db;
grant all privileges on database import_dbms_db to import_dbms_user;

\du shows:
import_dbms_user | | {}
postgres | Superuser, Create role, Create DB, Replication | {}

In the pg_hba.conf I set as:
# local DATABASE USER METHOD [OPTIONS]
local import_dbms_db import_dbms_user md5
and restart Postgres.

However when I try to run psql from the command line:
psql -h localhost -U import_dbms_user -WI enter password when prompted
Password for user import_dbms_user:
psql: FATAL: database "import_dbms_user" does not exist

But I get the error as above.

Trying to understand what I may be doing wrong.

Do I need to assign some kind of login role to import_dbms_user or such?

i assumed in the pg_hba.conf the line above is all I needed to log in locally?
local import_dbms_db import_dbms_user md5

And instead of local I would enter IP address of machine from which I would want to log in to the server?
192.168.1.10 import_dbms_db import_dbms_user md5

I am running on a VM and am trying to run some python scripts with psycopg2 to load some data.

So that script cannot log in either. Do I need to create any special role / privilege for that user to login from that script as well?

Thank you for your help!

Mono

listener-thread: err = -25582: oserr = 0: errstr = : Network connection is broken

$
0
0
Hello everybody!
I need your help!
There was an error("17:08:04 listener-thread: err = -25582: oserr = 0: errstr = : Network connection is broken." or "20:18:04 listener-thread: err = -25580: oserr = 4: errstr = : System error occurred in network function. System error = 4.") in the online.log.The error bothering me, but I don't know what it is hidden danger.

It doesn't happen very often and there is no law.Seen as follows:
----------
Sun Sep 8 00:01:19 2013
16:48:04 listener-thread: err = -25582: oserr = 0: errstr = : Network connection is broken.
……
Tue Sep 10 00:00:50 2013
06:28:04 listener-thread: err = -25580: oserr = 4: errstr = : System error occurred in network function.System error = 4.
……
Wed Sep 11 00:00:40 2013
19:28:14 listener-thread: err = -25582: oserr = 0: errstr = : Network connection is broken.
……
Mon Sep 16 00:00:16 2013
08:08:04 listener-thread: err = -25582: oserr = 0: errstr = : Network connection is broken.
……
Fri Sep 20 00:00:30 2013
22:18:04 listener-thread: err = -25582: oserr = 0: errstr = : Network connection is broken.
……
Sat Sep 21 00:00:23 2013
14:58:04 listener-thread: err = -25582: oserr = 0: errstr = : Network connection is broken.
……
Mon Sep 23 00:00:41 2013
03:48:04 listener-thread: err = -25580: oserr = 4: errstr = : System error occurred in network function.System error = 4.
-------

What is the effect of this problem and hidden trouble, how should I handle?

Duplicate key was ignored warning returned even when no duplicates are found

$
0
0
Hi
I am having problems with the "Duplicate key was ignored" warning message. The problem is that the message seems to happen randomly and cannot be reproduced. If i take the same set of data and run the stored procedure that causes the problem i don't get the warning message a second or subsequent time. Also all the SELECT statements have criteria set to remove duplicates before they are inserted into the tables.

Background to the problem:
I have a data feed that pulls data from a DB2 database to a SQL Server 2008 staging table as a flattened set of records. A stored procedure in SQL Server is run to load the data into the destination tables. The data feed is run hourly for new and updated records in DB2 Monday-Friday 09:00-17:00 and then there is a midnight run of all the records going back for the last 12 months.

The data feed was originally sent from DB2 as a CSV file and pulled into SQL Server using SSIS but is now an Informatica workflow that pulls the data directly from DB2.

It is the Informatica workflow that is returning the "duplicate key was ignored" warning message and this stops the workflow. The workflow is restarted and the data is always loaded the second time without the warning message. The warning does not happen every time the workflow is run - it can run for a number of days with no warnings and then one will come through

I can see in Profiler that it is SQL Server that returns the Duplicate key was ignored warning message so it is not an issue with Informatica.

I cannot reproduce the problem to get to the root cause of the issue. I would expect that if i run the same set of data through the stored procedure i would get the warning message every time, but this is not the case. Even when i step through the stored procedure i do not get the message. As the midnight data feed returns the records from the last 12 months, so by definition would include duplicates, the warning message only appears randomly and is not consistent.

Is this a bug in SQL Server or does anyone have a suggestion of where else to look?

Trigger - Add to a date using a subquery

$
0
0
Hello,
I'v 2 tables
Table 1 (extinguisher)
extinguisher_id (serial)
type_designation_extinguisher_type(text)
manufacturing_date (date)
life_date(date)

Table 2 (extinguisher_designation)
extinguihser_type(serial)
extinguisher_designation(text)
lifespan(int)

lifespan can take values like: 10 or 20 and it represents years

My objective is to do a trigger that will automaticly populaty talbe1.life_date based on the extinguisher_type using table2.

The problem is that lifespan is an int and can change.
The usual way to add year to a date is using
date + interval '10 year'

the problem is that i want a variable instead of the 10.

At this point i'v this:
CREATE OR REPLACE FUNCTION ext_life_span()
RETURNS trigger AS
$BODY$
DECLARE
new_date timestamptz;
manu_date char(10);
intervalo char(10);
BEGIN
IF (TG_OP = 'INSERT') THEN
intervalo := to_char((SELECT lifespan FROM extinguisher_type, extinguisher where type_designation = type_designation_extinguisher_type), '99999');
manu_date := to_char(New.manufacturing_date, 'YYYY-MM-DD');
new_date := (date 'manu_date' + integer 'intervalo' );
update extinguisher set life_date = new_date;
RETURN NULL;
ELSIF (TG_OP = 'UPDATE') THEN
IF new.manufacturing_date IS DISTINCT FROM old.manufacturing_date THEN
intervalo := to_char((SELECT lifespan FROM extinguisher_type, extinguisher where type_designation = type_designation_extinguisher_type), '99999');
manu_date := to_char(New.manufacturing_date, 'YYYY-MM-DD');
new_date := (date 'manu_date' + integer 'intervalo' );
update extinguisher set life_date = new_date;
END IF;
RETURN NULL;
END IF;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION ext_life_span() OWNER TO postgres;

CREATE TRIGGER insert_lifespan
AFTER INSERT OR UPDATE OF manufacturing_date
ON "extinguisher"
FOR EACH ROW
EXECUTE PROCEDURE ext_life_span();


I'm getting an error: invalid input syntax for type date: "menu_date"

Am I doing the best aproach? Or there is an easier way to do it?

Sql1646n

$
0
0
Hi every body,

SQL1646N:A routine failed because the fenced user ID cannot access required files in the sqllib directory or other instance or database directories.

this the error i am receiving when i am trying to run a procedure or a declare statement.

Please guys if any one has face this kind of issue or solved it previously help me out.

In the diaglog this is what i found :




2013-09-27-16.31.02.791606+330 I61581195A669 LEVEL: Severe
PID : 30006 TID : 2199354599760 PROC : db2sysc 0
INSTANCE: xxxxxxxxxxx NODE : 000 DB : MBCPROD
APPHDL : 0-31 APPID: *LOCAL.dbdiphx.130927110105
AUTHID : xxxx HOSTNAME: xxxxxx
EDUID : 37 EDUNAME: db2agent (MBCPROD) 0
FUNCTION: DB2 UDB, routine_infrastructure, sqlerGetFmpThread, probe:20
RETCODE : ZRC=0xFFFFF992=-1646
SQL1646N A routine failed because the fenced user ID cannot access
required files in the sqllib directory or other instance or database
directories.


2013-09-27-16.31.02.791819+330 E61581865A3550 LEVEL: Error
PID : 30006 TID : 2199354599760 PROC : db2sysc 0
INSTANCE: xxxxx NODE : 000 DB : MBCPROD
APPHDL : 0-31 APPID: *LOCAL.dbdiphx.130927110105
AUTHID : xxxx HOSTNAME: xxxxxx
EDUID : 37 EDUNAME: db2agent (MBCPROD) 0
FUNCTION: DB2 UDB, routine_infrastructure, sqlerRemoveAllIPCforRow, probe:10
DATA #1 : String, 32 bytes
Freeing IPC resource explicitly:
DATA #2 : sqlerFmpRow, PD_SQLER_TYPE_FMP_ROW, 544 bytes
fmpPid: 1453
fmpPoolList Ptr: 0x0000000000000000 fmpForcedList Ptr: 0x0000000000000000
nextFmpCB Ptr: 0x0000000101af9640 prevFmpCB Ptr: 0x0000000000000000
fmpIPCList Ptr: 0x0000000101afab00
stateFlags: 0x00000152 numFmp32Attaches: 0
numActiveThreads: 0 numPoolThreads: 0
fmpCodePage: 0 fmpRowUseCount: 0
active: 0x01 rowLoaderValidate: 0x00
ipcLatch:
0x0000000101AFA8C4 : 003C 0000 .<..
rowLatch:
0x0000000101AFA8C8 : 01BB 0001 ....
fmpAgentList:
0x0000000101AFA8D0 : 0008 0007 3433 0000 0000 0000 0000 0000 ....43..........
0x0000000101AFA8E0 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFA8F0 : 0000 0000 0000 0000 0000 0000 2A00 0000 ............*...
0x0000000101AFA900 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFA910 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFA920 : 0000 0000 2A00 0000 0000 0000 0000 0000 ....*...........
0x0000000101AFA930 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFA940 : 0000 0000 0000 0000 0000 0000 2A00 0000 ............*...
0x0000000101AFA950 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFA960 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFA970 : 0000 0000 2A00 0000 0000 0000 0000 0000 ....*...........
0x0000000101AFA980 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFA990 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFA9A0 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFA9B0 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFA9C0 : 0000 0000 5345 4D41 5048 4F52 4520 5741 ....SEMAPHORE WA
0x0000000101AFA9D0 : 4954 0000 0000 0000 0000 0000 0000 0000 IT..............
0x0000000101AFA9E0 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFA9F0 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFAA00 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFAA10 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFAA20 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFAA30 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFAA40 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFAA50 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFAA60 : 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0000000101AFAA70 : 0000 0001 01AF A8C0 0000 0001 01AF D120 ...............
0x0000000101AFAA80 : 0000 0001 0457 B9C0 0000 0000 0000 0000 .....W..........
0x0000000101AFAA90 : 0000 0000 0000 0000 0000 0001 0000 0000 ................
DATA #3 : Hexdump, 8 bytes
0x0000000101AFAB00 : 0000 0000 0000 0000 ........

2013-09-27-16.31.02.792093+330 E61585416A743 LEVEL: Error
PID : 30006 TID : 2199354599760 PROC : db2sysc 0
INSTANCE: xxxx NODE : 000 DB : MBCPROD
APPHDL : 0-31 APPID: *LOCAL.dbdiphx.130927110105
AUTHID : xxxxx HOSTNAME: xxxxx
EDUID : 37 EDUNAME: db2agent (MBCPROD) 0
FUNCTION: DB2 UDB, routine_infrastructure, sqlerRemoveAllIPCforRow, probe:20
DATA #1 : String, 22 bytes
IPC resources Address:
DATA #2 : Pointer, 8 bytes
0x0000000110050080
DATA #3 : String, 25 bytes
FMP Shared Memory Offset:
DATA #4 : unsigned integer, 4 bytes
327808
DATA #5 : String, 30 bytes
32 Bit FMP in 64 Bit Instance:
DATA #6 : Boolean, 1 bytes
false

2013-09-27-16.31.02.792259+330 E61586160A2415 LEVEL: Error
PID : 30006 TID : 2199354599760 PROC : db2sysc 0
INSTANCE: xxxxxxxxxxxxxx NODE : 000 DB : MBCPROD
APPHDL : 0-31 APPID: *LOCAL.dbdiphx.130927110105
AUTHID : xxxxxxxxxx HOSTNAME: xxxxxxxxxxx
EDUID : 37 EDUNAME: db2agent (MBCPROD) 0
FUNCTION: DB2 UDB, routine_infrastructure, sqlerRemoveAllIPCforRow, probe:30
DATA #1 : String, 29 bytes
Number of IPC resource found:
DATA #2 : signed integer, 4 bytes
1
DATA #3 : String, 29 bytes
Number of IPC resource freed:
DATA #4 : signed integer, 4 bytes
1
CALLSTCK: (Static functions may not be resolved correctly, as they are resolved to the nearest symbol)
[0] 0x0000020001CCC6D0 _Z23sqlerRemoveAllIPCforRowP11sqlerFmpRowb + 0x560
[1] 0x0000020001CD1AF4 /db2/dbusers/dbdiphx/sqllib/lib64/libdb2e.so.1 + 0x1CC0AF4
[2] 0x0000020001CD1BDE _Z23sqlerRemoveFmpFromTableP11sqlerFmpRowb + 0x4E
[3] 0x0000020001CD1FE4 /db2/dbusers/dbdiphx/sqllib/lib64/libdb2e.so.1 + 0x1CC0FE4
[4] 0x0000020001CDAAAC _Z19sqlerGetFmpFromPoolP14sqlerFmpHandleP13sqlerFm pParms + 0xE50
[5] 0x0000020001CDB8C4 _Z24sqlerInvokeFencedRoutineP13sqlerFmpParms + 0x5BC
[6] 0x000002000411F5B2 _Z18sqlriInvokeInvokerP10sqlri_ufobb + 0x1392
[7] 0x0000020004121AA0 _Z9sqlricallP8sqlrr_cb + 0x1EC
[8] 0x0000020003FABE4E _Z15sqlriSectInvokeP8sqlrr_cbP12sqlri_opparm + 0x7C2
[9] 0x0000020003AFD8D4 _Z29sqlrr_process_execute_requestP8sqlrr_cbib + 0x237C
[10] 0x0000020003AD0F2C _Z13sqlrr_executeP14db2UCinterfaceP9UCstpInfo + 0x244
[11] 0x0000020001EE882E _Z19sqljs_ddm_excsqlsttP14db2UCinterfaceP13sqljDDM Object + 0x5E6
[12] 0x0000020001EB42F2 _Z21sqljsParseRdbAccessedP13sqljsDrdaAsCbP13sqljDD MObjectP14db2UCinterface + 0x306
[13] 0x0000020001EB5012 _Z10sqljsParseP13sqljsDrdaAsCbP14db2UCinterfaceP8s qeAgentb + 0x322
[14] 0x0000020001EA9CA8 /db2/dbusers/dbdiphx/sqllib/lib64/libdb2e.so.1 + 0x1E98CA8
[15] 0x0000020001EADD70 /db2/dbusers/dbdiphx/sqllib/lib64/libdb2e.so.1 + 0x1E9CD70
[16] 0x0000020001EAE4CE _Z17sqljsDrdaAsDriverP18SQLCC_INITSTRUCT_T + 0x14E
[17] 0x0000020001B06534 _ZN8sqeAgent6RunEDUEv + 0x548
[18] 0x0000020004D0D986 _ZN9sqzEDUObj9EDUDriverEv + 0x222
[19] 0x000002000360E62E sqloEDUEntry + 0x2BE
[20] 0x0000004E1CE0CD86 /lib64/libpthread.so.0 + 0x7D86
[21] 0x0000004E1CD6C98E /lib64/libc.so.6 + 0xF398E

SQL , STRING value match

$
0
0
Quote:

emp

EMPNO ENAME
----- ----------
1 FARHAN
2 JIMMY
3 DAVID
4 JAMES
Quote:

emp_full

ENAME_FULL Job
------------- ---
FARHAN SYED Analyst
JIMMY JAMES Manager
DAVID FOX Sales
PAUL SMITH Markting
JAMES BRADFORM Admin
Hi All ,
I would like to match the above tables (emp/emp_full) , I've used the following SQL but doesn't work , could you please help me.
Second part of the SQL I also would like to pull the JOB in my result

Many thanks
Farhan

My Attemt is as follows

Code:

select *
from REFDATA.EMP
where SUBSTR(ENAME_FULL,1,5)) = ANY
 (select  ENAME_FULL from "REFDATA"."EMP_DETAIL")

DB2 data load issue

$
0
0
Actually I am using JCL to run the DSNUPROC in a step.
In this step i have infile(SYSREC00) with data and sysin cards that
tells to load data into table.Please find the JCL step below
//LOADAIM EXEC DSNUPROC,
// COND=(1,LT),
// PARM='&DB2SYS,LSPMAIM'
//SYSREC00 DD DSN=XX.AGT.SPM948.SORT02.CRPITM,
// DISP=(SHR,KEEP,KEEP)
//SYSIN DD DSN=XX.AG.DATA(LDRPLAIM),
// DISP=(SHR,KEEP,KEEP)
// DD DSN=XX.AG.DATA(LSPMAIM),
// DISP=(SHR,KEEP,KEEP)
//SYSUT1 DD UNIT=SYSDA,
// SPACE=(TRK,(500,5000),RLSE)
//SORTOUT DD UNIT=SYSDA,
// SPACE=(TRK,(100,5000),RLSE)


Here SYSIN card is having the data like below:
LOAD DATA LOG NO NOCOPYPEND REPLACE INDDN SYSREC00
INTO TABLE DB2PDBA.AIM_CRPRT_RTL_ITEM
(
FACILITY POSITION( 1 )
CHAR( 2) ,
WAREHOUSE POSITION( 3 )
CHAR( 2) ,
ITM_CD POSITION( 5 )
CHAR( 7) ,
PROD_UPC POSITION( 12 )
CHAR( 15) ,
ITM_SIZ_DSC POSITION( 27 )
CHAR( 15) ,
ITM_UNT_CMP_DSC_CD POSITION( 42 )
CHAR( 2) ,
DESC_SHORT POSITION( 44 )
CHAR( 20) ,
RTL_CMDTY_CD POSITION( 183 )
CHAR( 3) ,
RTL_SUB_CMDTY_CD POSITION( 186 )
CHAR( 3) ,
ORDR_BOOK_INDX_CD POSITION( 189 )
CHAR( 5) ,
NEW_ITM_DT POSITION( 194 )
DATE EXTERNAL( 10) ,
VEN_CD POSITION( 204 )
CHAR( 7) ,
ORGNL_FCLTY_CD POSITION( 211 )
CHAR( 2)
)


But when I ran this step thru job, input file SYSREC00 has data but
message is coming as below:

db2 -mvtf /tmp/load.55.DSNUPROC_DSNUPROC
LOAD CLIENT FROM /awg/p1/agt/XX/XX.AGT.SPM948.SORT02.CRPITM OF ASC MODIFIED BY CODEPAGE=819 STRIPTNULLS BINARYNUMERICS PAC
KEDDECIMAL DATEFORMAT="YYYY-MM-DD" TIMESTAMPFORMAT="YYYY-MM-DD-HH.MM.SS.UUUUUU" TIMEFORMAT="HH.MM.SS" NULLINDCHAR=X6F RECL
EN=212 METHOD L ( 1 2,3 4,5 11,12 26,27 41,42 43,44 63,64 66,67 69,70 72,73 74,75 76,77 77,78 79,80 80,81 83,84 133,134 14
8,149 151,152 154,155 158,159 162,163 163,164 165,166 166,167 176,177 177,178 178,179 180,181 181,182 182,183 185,186 188,
189 193,194 203,204 210,211 212 ) null indicators ( 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,
0,0 ) REPLACE INTO DB2PDBA.AIM_CRPRT_RTL_ITEM ( FACILITY,WAREHOUSE,ITM_CD,PROD_UPC,ITM_SIZ_DSC,ITM _UNT_CMP_DSC_CD,DESC_SHO
RT,POS_RTL_STO_DPT,ITM_CMD_CD,ITM_SUB_CMD_CD,UNT_P RC_WGT_DSC_CD,CUR_RTL_WHT_FOR,ITM_PRV_LAB_CD,WHS_D PT,ITM_CHK_DGT,RTL_UNT
_WGT_AMT,ITM_DSC,CASE_UPC,POS_RTL_MIX_MCH,ORD_MULT _QTY,RTL_UNT_VEN_CSE,RTL_UNT_STR_CSE,RDM_WGT_FL,VE N_CSE_PER_LAY,ITM_STT_
DCT,ITM_DCT_DT,SHP_FL,SPR_SHF_LBL,NBR_LAY_PER_PAL, VNDR_PACK_CHG,PRMTN_FL,RTL_CMDTY_CD,RTL_SUB_CMDTY_ CD,ORDR_BOOK_INDX_CD,N
EW_ITM_DT,VEN_CD,ORGNL_FCLTY_CD ) NORECOVERABLE
SQL0104N An unexpected token "NORECOVERABLE" was found following ")".
Expected tokens may include: "COPY". SQLSTATE=42601

Actually keyword NORECOVERABLE is not in the card only after the Load query
but still this keyword NORECOVERABLE got added and saying unable to
identify the keyword NORECOVERABLE.
And sending this Sqlstate as 42601.
Can any one help me on this issue please.

Recursive SQL Duplicates

$
0
0
I'm having issues with my script bringing back duplicate names and I'm not sure how to fix it. My script concatenates columns into a row. Basically I have admin names that I need listed in the same row and column of the building they are assigned. The admin names are listed multiple times and when I concatenate the rows it lists the admin name as follows (John Doe | John Doe). Point of Contact and list sometimes contain different names. I need to exclude the duplicate names in the list. I have attached a screen shot of the current and desired results. Your help is appreciated.

Code:

with
 
  t1(rowNum, PROJECT_ID, NAME_LAST, NAME_FIRST, POINT_OF_CONTACT, PROJECT_NAME, BUILDING_ID, BUILDING_NAME, HOURS_USED,
  HOURS_TO_USE, PERCENTAGE_USED, CAPABILITY, BUCKET_A, BUCKET_B, BUCKET_C ) as
 
  (
      SELECT distinct RowNumber() over (PARTITION BY F2H.DIM_PROJECT_ID, F2H.DIM_BUILDING_ID ORDER BY F2H.PROJECT_NAME, F2H.BUILDING_NAME),
           
        F2H.DIM_PROJECT_ID,
        F2P.NAME_LAST,
        F2P.NAME_FIRST,
        REPLACE(F2P.POINT_OF_CONTACT, ',', ' |') AS POINT_OF_CONTACT,
        F2H.PROJECT_NAME,
        F2H.DIM_BUILDING_ID,
        F2H.BUILDING_NAME,
        F2H.HOURS_USED AS HOURS_USED,
        F2H.HOURS_TO_USE AS HOURS_TO_USE,
        F2H.PERCENTAGE_USED AS PERCENTAGE_USED,
        F2SB.CAPABILITY AS CAPABILITY,
        F2SB.BUCKET_A AS BUCKET_A,
        F2SB.BUCKET_B AS BUCKET_B,
        F2SB.BUCKET_C AS BUCKET_C
FROM FACT_TABLE AS F13
INNER JOIN DIM_ADMIN AS F2P ON F13.DIM_PROJECT_ID = F2P.DIM_PROJECT_ID
INNER JOIN DIM_HOURS AS F2H ON F13.DIM_PROJECT_ID = F2H.DIM_PROJECT_ID
INNER JOIN BUCKETS AS F2SB ON F13.DIM_PROJECT_ID = F2SB.DIM_PROJECT_ID
WHERE F2H.BUILDING_NAME IN ('MAIN', 'WAREHOUSE')


group by 
        F2H.DIM_PROJECT_ID,
        F2H.PROJECT_NAME,
        F2P.NAME_LAST,
        F2P.NAME_FIRST,
        F2P.POINT_OF_CONTACT,
        F2H.DIM_BUILDING_ID,
        F2H.BUILDING_NAME,
        F2H.HOURS_USED,
        F2H.HOURS_TO_USE,
        F2H.PERCENTAGE_USED,
        F2SB.CAPABILITY,
        F2SB.BUCKET_A,
        F2SB.BUCKET_B,
        F2SB.BUCKET_C 
 ) ,
 
      t2(PROJECT_ID, LIST, POINT_OF_CONTACT, PROJECT_NAME, BUILDING_ID, BUILDING_NAME, HOURS_USED, HOURS_TO_USE, PERCENTAGE_USED, CAPABILITY,
      BUCKET_A, BUCKET_B, BUCKET_C, cnt) AS
    ( SELECT    PROJECT_ID,
                VARCHAR(NAME_FIRST CONCAT ' ' CONCAT NAME_LAST, 6000),
                POINT_OF_CONTACT,
                PROJECT_NAME,
                BUILDING_ID,
                BUILDING_NAME,
                HOURS_USED,
                HOURS_TO_USE,
                PERCENTAGE_USED,
                CAPABILITY,
                BUCKET_A,
                BUCKET_B,
                BUCKET_C,
                1
    FROM t1
            WHERE rowNum = 1
            UNION ALL
    SELECT
        t2.PROJECT_ID,
                t2.list || ' | ' || t1.NAME_FIRST CONCAT ' ' CONCAT t1.NAME_LAST,
                t1.POINT_OF_CONTACT,
                t1.PROJECT_NAME,
                t1.BUILDING_ID,
                t1.BUILDING_NAME,
                t1.HOURS_USED,
                t1.HOURS_TO_USE,
                t1.PERCENTAGE_USED,
                t1.CAPABILITY,
                t1.BUCKET_A,
                t1.BUCKET_B,
                t1.BUCKET_C,
                t2.cnt + 1
    FROM t2, t1
            WHERE t2.project_id = t1.project_id
            AND          t2.BUILDING_id = t1.BUILDING_id
            AND  t2.cnt + 1 = t1.rowNum )   
    SELECT
                      PROJECT_ID,
                PROJECT_NAME,
                POINT_OF_CONTACT,
                BUILDING_ID,
                BUILDING_NAME,
                HOURS_USED,
                HOURS_TO_USE,
                PERCENTAGE_USED,
                CAPABILITY,
                        BUCKET_A,
                        BUCKET_B,
                        BUCKET_C,
                list
    FROM t2
            WHERE ( PROJECT_ID, BUILDING_ID, cnt ) IN (
    SELECT PROJECT_ID, BUILDING_ID, MAX(rowNum)
    FROM t1
            GROUP BY PROJECT_ID, BUILDING_ID )   
            order by PROJECT_NAME


Attached Images
File Type: png Capture.PNG (31.4 KB)
File Type: png Capture1.PNG (25.6 KB)

split function in vba does not work as expected

$
0
0
Hi all,
I have a text box control on a form that get populated with file path such as :

Quote:

C:\Users\babarnc\Documents\test.xls
C:\Users\babarnc\Documents\test2.xls
C:\Users\babarnc\Documents\test3.xls
I need to store in a table each file path, file name and extension.

So first step for me is to store each line of the textbox into a sting array:

Code:

Private Sub Cmd_OK_Click()
    Dim FullNameToFile() As String
    Dim OldPath As String
    Dim i As Long
    Dim nofFiles As Long
   
    FullNameToFile() = Split(Me.Txt_File, vbLf)
    nofFiles = UBound(FullNameToFile) - LBound(FullNameToFile) + 1
   
    For i = 0 To nofFiles - 1
        OldPath = OldPath & FullNameToFile(i) & "+"
    Next
    MsgBox OldPath
End Sub


and here is what I get in my message box:

Quote:

C \Users\babarnc\Documents\test xls+C \Users\babarnc\Documents\test2 xls+C \Users\babarnc\Documents\test3 xls++
Where has all my punctuation gone???
Now without ":" or "." my path are useless, and there is no way to rebuilt them as some file or folder name may well have spaces

I have tried to find help on internet but as soon as you type split and punctuation you get load of example on how to get ride of the punctuation, and nothing about how to keep it

Problem with double digits in primary key

$
0
0
I have started to transfer over info form the old database into the new one and when I got up to the double digits in the primary key "Week" something weird began to happen. The database would order it where week 1 was first but after that it jumped to 10 through 16 then back down to 2 through 9. Is it reading them as decimals and if so how to i make it stop?

Code troubles with password protecting a tab control

$
0
0
Hello. I have a tab control with two tabs. I'd like to password protect the second tab. Nothing is happening when I enter the code. Here is the code I'm using:

Private Sub TabCtl1076_Change()
Dim strInput As String
Dim ctl As Control

' Hide controls on tab until correct password is entered
For Each ctl In Controls
If ctl.Tag = "*" Then
ctl.Visible = False
End If
Next ctl

' If tab page with Tab Index of 1 is selected
' show InputBox asking for password
If TabCtl0.Value = 1 Then
strInput = InputBox("Please enter a password to access this tab", _
"Restricted Access")

' Check if value is entered into InputBox
' If no value entered display MsgBox
If strInput = "" Or strInput = Empty Then
MsgBox "No Input Provided", , "Required Data"
TabCtl0.Pages.Item(0).SetFocus
Exit Sub
End If

' Check InputBox value and if value is a match
' display tab and unhide hidden fields
If strInput = "password" Then

For Each ctl In Controls
If ctl.Tag = "*" Then
ctl.Visible = True
End If
Next ctl
' If incorrect password supplied return to tab (index 0)
Else
MsgBox ("Sorry, you do not have access to this information")
TabCtl0.Pages.Item(0).SetFocus

Exit Sub
End If
End If

End Sub

Unknown winsock error 10061

$
0
0
Hi,
i'm developing a webapp working on TomEE. I set up the database settings (localhost/127.0.0.1) but i get this error: Unknown winsock error 10061
I'm working on Win7 SP1, i tried Postgres 8.4 and 9.2
I turned off Antivirus and firewalls

Could somebody tell me what the problem could be? It's not the first time i work with postgres, on Tomcat 6 i'm able to run it correctly...

Please help. :confused:

Creating Primary Key after CREATE TABLE: To create Sequence when using ALTER TABLE

$
0
0
I had a question on creating PK with alter table, after table is created.

I understand I create a PK id during create table by stating id as follows:
id serial primary key

For a table testing, it implicitly creates index and the sequence testing_id_seq to be associated with the id field.
I can list the sequence with \ds.

...
However if I create a primary key with alter table primary key as in:

import_dbms_db=> alter table testing ADD CONSTRAINT pkid PRIMARY KEY (id);
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "pkid" for table "testing"
ALTER TABLE
import_dbms_db=> \ds
No relations found.

It does not create a sequence.

...
So I am assuming I have to create the sequence and associate it with the column separately as well?

Is there a way to create primary key with the alter table to allow the sequence to be created automatically and associated with the primary key?

I did not find anything on this so just wanted to confirm - so I write my scripts accordingly.

Also during creating indexes (primary, secondary or foreign) am I allowed to create indexes with same name but on different tables? Or do index names have to be different across tables? probably good programming practice as well to have different index names across tables even if allowed?

Thank you for your help and suggestions.

Import/Export command in IBM Data Studio

$
0
0
Hi,

We have DB2 9.5 installed on Linux and using IBM Data Studio 3.1 and 4.1 to do the devlopment. Whenever I import a file, this file is saved in linux and I have to use WINSCP to move the file to the local machine.

Before IBM Data Studio when using Command Editor, I was able to save the file on the local machine and same with the EXPORT command.

I change the Run method to Command Line Processor and then use the IMPORT/Export Commands.

Is there a simple way to save the files or export the files from the local C: drive.

Regards,

Nav

VBA to refresh upon open not running

$
0
0
I have the simple VBA code

Private Sub Workbook_Open()
ThisWorkbook.RefreshAll
End Sub

to refresh the connections from my Access queries, but it's not refreshing anything when I open. I have to go to Developer, VB and hit Run to get it to work. Am I doing something wrong?

I know I could click on the Refresh under connection properties, but I have mulitple users importing into the DB and I'm using excel as the template for the output. They need to be able to save after each workbook refresh to maintain that data for any particular customer (and then start all over again with the importing for a different customer). We're not Excel experts by far, so I figured I'd save the template as an xlsm and they can save after the run as an xlsx.

Primitive Database Design in Visio

$
0
0
Hello,

I'm designing a database in Visio. I'm only able to edit the child side of the relationship ex. one-to-one or zero-to-one - using crows foot notation.

Also, I'm in dire need of some help regarding compound keys and junction tables - and the logic surrounding implementing those.

Take a look and please criticize.
Keep in mind I can't properly adjust my relationship types.

Attachment 14927

Attached Images
File Type: png Capture.PNG (26.5 KB)

Storing a TempVar in a table

$
0
0
Good Evening

I have a login Screen on launch of the database which records the tempvar of the user

TempVars.Add "user", Me.username.Column(1)

I have a form "Incrptfrm" which has it control source to a table Incrpttbl

One of the feilds within the table and form is "Attended By" which is to be set to the Tempvar.

The tempvar displays in an unbound text box with =[tempvars]![user] in the control source but this is not applicable as I need the information to be stored in the table not just displayed on the form.

I have tired setting the default value in the properties sheet for "Attended By" to [tempvars]![user] which was demostrated on utube but this does not work.

Any Suggestions would be helpful

Thank you
Viewing all 13329 articles
Browse latest View live