X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B3EB49DCDFF for ; Mon, 20 Mar 2006 10:55:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95474-02 for ; Mon, 20 Mar 2006 10:55:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gk-us2.us.michelin.com (gk-us2.michelin.com [156.65.14.19]) by postgresql.org (Postfix) with ESMTP id 56E6A9DCB9C for ; Mon, 20 Mar 2006 10:55:42 -0400 (AST) Received: from oncpfxp4-out.onc.michelin.com (unverified [10.21.4.32]) by gk-us2.us.michelin.com (Clearswift SMTPRS 5.1.7) with ESMTP id for ; Mon, 20 Mar 2006 09:54:37 -0500 Received: from ONCMH1.onc.michelin.com (ONCMH1.onc.michelin.com [156.65.124.40]) by oncpfxp4-out.onc.michelin.com (Postfix) with ESMTP id 027961A73B for ; Mon, 20 Mar 2006 09:55:45 -0500 (EST) Received: from oncmtap1.onc.michelin.com by oncmh1.onc.michelin.com with ESMTP for pgsql-odbc@postgresql.org; Mon, 20 Mar 2006 09:55:43 -0500 Received: from oncems01.onc.michelin.com ([156.65.125.150]) by oncmtap1.onc.michelin.com (Netscape Messaging Server 4.15) with ESMTP id IWFLGV00.H2Q for ; Mon, 20 Mar 2006 09:55:43 -0500 Received: from [10.43.12.183] (unverified) by oncems01.onc.michelin.com (Content Technologies SMTPRS 4.2.5) with ESMTP id ; Mon, 20 Mar 2006 09:55:42 -0500 Message-Id: <441EC26C.1020309@us.michelin.com> Date: Mon, 20 Mar 2006 09:55:40 -0500 From: "Campbell, Greg" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pragadheeswaran gopalakrishnan , "Pgsql-Odbc (E-mail)" Subject: Re: How To Connect PostgreSQL thru VB without DSN References: <441C8709.2080004@us.michelin.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------080608070604070804000306" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.233 required=5 tests=[AWL=0.081, RCVD_IN_WHOIS_INVALID=2.151, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 2.233 X-Spam-Level: ** X-Archive-Number: 200603/107 X-Sequence-Number: 7393 This is a multi-part message in MIME format. --------------080608070604070804000306 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 1. One thing at a time. Eliminate the section where you try to put data into the database. Does the connection work. Do you get to the msgbox "Connection Message"? 2. Your pg_hba.conf host sections -- I hope you realize those are the addresses of your clients, so your VB work station would have to have an I.P. of 200.200.200.something. 3. A normal PG problem would throw an error, which would show up as a message box, but VB would not crash and close -- but your application will if it doesn't catch and handle errors. VB crashing indicates a more gross error -- bad VB installation, missing References, code that's just wrong, etc. 4. The rsFriends seems to be missing a declaration and instantiation. eg. Dim rsFriends as ADODB.Recordset Set rsFriends = new ADODB.Recordset (Dim x as new Object -- is considered a somewhat sloppier form, because it does not match the Set x= Nothing) But as my first words indicate, don't worry about INSERTS or SELECTS until you are sure Connect will work. 5. Once you get the connect with the DSN, work on the DSN-less connect with the "Driver=..." string. pragadheeswaran gopalakrishnan wrote: >>4. Does your PostgreSQL server permit the username and password your are >>trying to supply from your >>location? Check pg_hba.conf settings. >> >> >> > > Hi! Campbell, Thanks for replying, > > I will furnish some details for your kind notice. > > I am using VB to connect PostgreSQL database. It gets connected thru DSN > based code. > > The following is a segment of my pg_hba.conf file > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > . > . > . > > > # TYPE DATABASE USER CIDR-ADDRESS METHOD > > # IPv4 local connections: > host all all 127.0.0.1/32 md5 > host all all 200.200.200.1 255.255.255.0 > md5 > # IPv6 local connections: > host all all ::1/128 md5 > #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > When i run the code thru VB which is based on DSN leads to the following > error > "VB6.exe has generated errors and will be closed by Windows. You will need > to restart > the program." > > and VB itself gets closed after this error message > > my OS is WIN-2K > my postgreSQL version is 8.1 > > > The code, which i used to connect pgsql is the following > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > Dim cCon As New ADODB.Connection, rsFriends As New ADODB.Recordset > Private Sub Form_Load() > ConnectDB > End Sub > Private Sub ConnectDB() > On Error GoTo EH > > > cCon.ConnectionString = "DSN=pgsdsn;" & _ > "UID=steve;" & _ > "PWD=king;" & _ > "Database=mydb" > > cCon.Open > MsgBox "O.K.", vbInformation, "Connection Message" > With rsFriends > .Open "SELECT * FROM Friends", cCon, adOpenKeyset, > adLockPessimistic 'Here only the error is generated > .AddNew > .Fields![FriNam] = InputBox("Enter the Friend Name") > .Fields![SrlNum] = Val(InputBox("Enter the Serial Number")) > .Fields![DOB] = InputBox("Enter the Date of Birth") > .Fields![PhNo] = InputBox("Enter the Phone No:") > .Update > End With > If rsFriends.State = adStateOpen Then rsFriends.Close > Set rsFriends = Nothing > MsgBox "O.K.", vbInformation, "Recordset Message" > Exit Sub > Exit Sub > EH: > MsgBox Err.Description, vbCritical, "Error Message" > End Sub > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > > > > > > The following, is the Error details written in LOG file under the LOG folder > of POSTGRESQL > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > 2006-03-20 12:15:31 LOG: unexpected EOF on client connection > 2006-03-20 12:15:37 LOG: could not receive data from client: No connection > could be made because the target machine actively refused it. > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > > Many Thanks in advance. --------------080608070604070804000306 Content-Type: text/x-vcard; charset=utf-8; name="greg.campbell.vcf" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="greg.campbell.vcf" YmVnaW46dmNhcmQNCmZuOkdyZWcgQ2FtcGJlbGwNCm46Q2FtcGJlbGw7R3JlZw0Kb3JnOk1p Y2hlbGluIE5vcnRoIEFtZXJpY2EgLSBVUzUgTGV4aW5ndG9uO0VORy1BU0UNCmVtYWlsO2lu dGVybmV0OmdyZWcuY2FtcGJlbGxAdXMubWljaGVsaW4uY29tDQp0aXRsZTpBU0UgU3lzdGVt cyBFbmdpbmVlcg0KdGVsO3dvcms6ODAzLTk1MS01NTYxL3g3NTU2MQ0KeC1tb3ppbGxhLWh0 bWw6RkFMU0UNCnZlcnNpb246Mi4xDQplbmQ6dmNhcmQNCg0K --------------080608070604070804000306--