Thread: No such connection NULL from ECPG
My program compiles without errors. When the binary is run, I get: No such connection NULL from line 384. Line 384 is: while(!sqlca.sqlcode){ blah blah blah } My connect line is 374: EXEC SQL CONNECT 'macs'; Ecpg expands this to: { ECPGconnect(__LINE__, NULL,"macs",NULL,NULL, 0);} I found a post in the 'general' mailing list from 1998 that suggests that the expansion should be: { ECPGconnect(__LINE__, "macs",NULL,NULL,NULL, 0);} Am I barking up the wrong tree? I recompiled and installed ecpg as root just to make sure I was not missing anything and still get the same expansion. TIA Phil -- pmoors@phillips.com | Speaking for himself only. -------------------------------------------------------- What if there were no hypothetical situations? --Andrew Kohlsmith
On Thu, Jun 24, 1999 at 06:19:39PM -0400, Phil Moors wrote: > No such connection NULL from line 384. Okay, the error message is fixed. But the question remain if we allow Oracle syntax or our own old syntax or only standard syntax. Michael -- Michael Meskes | Go SF 49ers! Th.-Heuss-Str. 61, D-41812 Erkelenz | Go Rhein Fire! Tel.: (+49) 2431/72651 | Use Debian GNU/Linux! Email: Michael.Meskes@gmx.net | Use PostgreSQL!
On Thu, Jun 24, 1999 at 06:19:39PM -0400, Phil Moors wrote: > My program compiles without errors. When the binary is run, I get: > > No such connection NULL from line 384. > > ... > My connect line is 374: > > EXEC SQL CONNECT 'macs'; The correct form is EXEC SQL CONNECT TO 'macs'; SQL92 wants to see the TO. > Ecpg expands this to: > > { ECPGconnect(__LINE__, NULL,"macs",NULL,NULL, 0);} Argh! This is one of the dreaded Oracle compatibility hacks. Oracle's connect syntax is: EXEC SQL CONNECT <username> So ECPG thinks macs is the username. But there is another problem. It shouldn't try to access connection NULL. The code says: if (dbname == NULL && connection_name == NULL) connection_name = "DEFAULT"; So why doesn't it display connection DEFAULT. I'll check that. > { ECPGconnect(__LINE__, "macs",NULL,NULL,NULL, 0);} It's line-number, db-name, user, password, connection_name, autocommit mode. > Am I barking up the wrong tree? No, there is a problem. Michael -- Michael Meskes | Go SF 49ers! Th.-Heuss-Str. 61, D-41812 Erkelenz | Go Rhein Fire! Tel.: (+49) 2431/72651 | Use Debian GNU/Linux! Email: Michael.Meskes@gmx.net | Use PostgreSQL!