Thread: Need help with Visual Basic 6 and PostgreSQL

Need help with Visual Basic 6 and PostgreSQL

From
Finn Lassen
Date:
I am very new to ADODB, ODBC and SQL databases.<br /><br /> When I run the following which I wrote to populate tables
(withdata from a Borland V database) , the Visual Basic Developer Interface crashes with the following error signature
(WindowsXP):<br /> AppName: vb6.exe     AppVer: 6.0.97.82     ModName: psqlodbc30a.dll<br /> ModVer: 8.2.4.0   
 Offset:00016edc<br /> ----------------------------------------------------------------------------  <br />     Dim
dbOutAs ADODB.Connection<br />     Dim rsOut As ADODB.Recordset<br />     Set dbOut = New ADODB.Connection<br />    
SetrsOut = New ADODB.Recordset<br /><br />     With dbOut<br />         .ConnectionString = "Driver={PostgreSQL
ANSI};Server=localhost;Port=5432;Database=postgres;Uid=user;Pwd=secret;"<br/>         .Open<br />         With rsOut<br
/>            rsOut.Open """Contact1""", dbOut, adOpenDynamic, adLockOptimistic, adCmdTable<br />             Do<br />
               .AddNew<br />                 For Each fld In .Fields<br />                     Debug.Print fld.name,
fld.Type<br/>                     Select Case fld.Type<br />                         Case 3 'integer (oid)<br />
                       Case 200, 202 'Memo -- Text (ANSI: 200, Unicode: 202)<br />                            fld.value
="Memo type text"<br />                         Case 133 'Date<br />                            fld.value = Date<br />
                       Case Else<br />                            fld.value = "FixedLengthStrings"                  <br
/>                    End Select<br />                 Next fld<br />                 <b>.Update</b><br />
               'Exit Loop code here<br />             Loop<br />             .Close<br />         End With<br />
       .Close<br />     End With<br />     Set dbOut = Nothing<br />     Set rsOut = Nothing<br />
--------------------------------------------------------------------------------------------------------<br/> Note: I
hadto add a "oid" column to the table or the rsOut.Open would fail with "ERROR: column "oid" does not exist;".<br /><br
/>It now crashes at the .Update statement.<br /> Previously it managed to add 2 rows to the table.<br /> Another oddity
iswhen using the VB Visual Data Manager add-in to view the database it will not list the Indexes for the Contact1
table.<br/> It will list the Indexes for the Contact2 table which is not populated nor been worked with.<br /><br />
Anysuggestions on how proceed?<br /> Do I have to configure the PostgreSQL ANSI driver somehow? If so, how?<br /><br />
Finn<br/><pre class="moz-signature" cols="72">-- 
 
Finn Lassen
Deputy CIO
Axiom
1805 Drew Street
Clearwater, Florida 33765
727-442-7774 voice
727-442-8344 fax
<a class="moz-txt-link-abbreviated" href="mailto:dcio@AxiomInt.com">dcio@AxiomInt.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.AxiomInt.com">www.AxiomInt.com</a>
</pre>

Re: Need help with Visual Basic 6 and PostgreSQL

From
Richard Broersma Jr
Date:
--- On Wed, 11/21/07, Finn Lassen <dcio@AxiomInt.com> wrote:
> It now crashes at the .Update statement.
> Any suggestions on how proceed?
> Do I have to configure the PostgreSQL ANSI driver somehow?

I would look at your PostgreSQL logs to see the exact crashing update statement that VB is sending to PostgreSQL to
process(you may need to first turn on query logging in your postgresql.conf file and then restart your PostgreSQL
service). Next I would try to manually run the listed update query in postgres' command line editor psql to see the
errormessage that it generates.  This will probably a very clear indication of what is wrong in your VB generated
record-setupdate.  

Also, give the how-to example for using ADO + ODBC + PG a try that comes with your ODBC installation help
documentation?
it is found in this path on my computer:
C:\Program Files\PostgreSQL\8.2\doc\psqlODBC\howto-vb.html

Also, you may consider using the PostgreSQL Unicode ODBC driver over the ANSI driver since it supports a larger array
ofcharacter sets. 

I wish I could be of more help, but I've never really grown accustom to using Records sets to update or delete records.
I've always manually crafted my own SQL statements that I've passed to the back-end server. 

Also at the risk of getting my head bitten off by someone more knowledgeable that disagrees :-), it is a good practice
toknow your database schema design well enough to know the names of your tables and columns.  It is also good practice
todirectly call out those column names in your code rather than simply guessing based on the field types. 

Regards,
Richard Broersma Jr.

Re: Need help with Visual Basic 6 and PostgreSQL

From
Paul Lambert
Date:
Finn Lassen wrote:
> I am very new to ADODB, ODBC and SQL databases.
>
> When I run the following which I wrote to populate tables (with data
> from a Borland V database) , the Visual Basic Developer Interface
> crashes with the following error signature (Windows XP):
> AppName: vb6.exe     AppVer: 6.0.97.82     ModName: psqlodbc30a.dll
> ModVer: 8.2.4.0     Offset: 00016edc

I had perhaps a similar issue with VB6 earlir this year - program
crashing on doing a .Update, though mine was an access violation.

Refer to the thread here:
http://archives.postgresql.org/pgsql-odbc/2007-03/msg00045.php

My solution in the end was to drop using recordsets and the
addNew/Update methods to constructing an SQL INSERT/UPDATE/DELETE
statement of my own and running that through .Execute on the database
object instead.

I'd suggest turning on logging on the ODBC driver, running your program
until it crashes and then checking the contents of the mylog and
psqlodbc log in your root c directory. They might give a hint as to what
the problem is - perhaps some funny data being sent through.

--
Paul Lambert
Database Administrator
AutoLedgers - A Reynolds & Reynolds Company

Re: Need help with Visual Basic 6 and PostgreSQL

From
Finn Lassen
Date:
On 21 Nov 07 10:17 PM, Richard Broersma Jr wrote: <blockquote cite="mid:523506.48216.qm@web31803.mail.mud.yahoo.com"
type="cite"><prewrap="">--- On Wed, 11/21/07, Finn Lassen <a class="moz-txt-link-rfc2396E"
href="mailto:dcio@AxiomInt.com"><dcio@AxiomInt.com></a>wrote:  </pre><blockquote type="cite"><pre wrap="">It now
crashesat the .Update statement.
 
Any suggestions on how proceed?
Do I have to configure the PostgreSQL ANSI driver somehow?   </pre></blockquote><pre wrap="">
I would look at your PostgreSQL logs to see the exact crashing update statement that VB is sending to PostgreSQL to
process(you may need to first turn on query logging in your postgresql.conf file and then restart your PostgreSQL
service). Next I would try to manually run the listed update query in postgres' command line editor psql to see the
errormessage that it generates.  This will probably a very clear indication of what is wrong in your VB generated
record-setupdate.  </pre></blockquote> After rebooting the computer, it will make it through the first iteration of the
loop(successful .Update). Next time through I get this (excerpt from log):<br /> ------------------------------<br />
2007-11-2220:21:14 ERROR:  column <b>""</b> of relation "Contact1" does not exist at character 40<br /> 2007-11-22
20:21:14STATEMENT:  BEGIN;insert into "public"."Contact1" (<b>"",</b> "Department", "TITLE", "SECR", "Phone1",
"Phone2","Phone3", "Fax", "Ext1", "Ext2", "Ext3", "Ext4", "(", "Address2", "Address3", "City", "State", "Zip",
"Country","Dear", "Source", "Key1", "Key2", "Key3", "Key4", "Key5", "Status", "MERGECODES", "CreateBy", "Owner",
"LastUser","LastDate", "LastTime", "VisibleTo", "RecID") values (E'93100765018597400Bru'...<br />
------------------------------<br/> skipping over the first 4 field labels before "Department". (I hope the quoted
squarebox will post correctly here.)<br /> During another run the "public" is replaced with the square box (whatever
thatcharacter is).<br /><blockquote cite="mid:523506.48216.qm@web31803.mail.mud.yahoo.com" type="cite"><pre wrap="">
 
Also, give the how-to example for using ADO + ODBC + PG a try that comes with your ODBC installation help
documentation?
it is found in this path on my computer: 
C:\Program Files\PostgreSQL\8.2\doc\psqlODBC\howto-vb.html </pre></blockquote> Thanks. But that would eventually
requirean OBDC data source definition on each work station, which I'd rather avoid....<br /><blockquote
cite="mid:523506.48216.qm@web31803.mail.mud.yahoo.com"type="cite"><pre wrap="">
 
Also, you may consider using the PostgreSQL Unicode ODBC driver over the ANSI driver since it supports a larger array
ofcharacter sets. </pre></blockquote> I tried that. Same results.<br /><blockquote
cite="mid:523506.48216.qm@web31803.mail.mud.yahoo.com"type="cite"><pre wrap="">
 
I wish I could be of more help, but I've never really grown accustom to using Records sets to update or delete records.
I've always manually crafted my own SQL statements that I've passed to the back-end server. </pre></blockquote> All I
wantedto do was to quickly populate two tables with data from an existing Borland database so I could run a speed
comparisonagainst Access and MySQL. I tried the "COPY" SQL statement, but could not easily get it to work because one
ofthe source fields is a Memo field containing all kinds of characters (but ANSI only). So I was recommended to use the
recordsetmethod and not having to worry about field delimiters.<br /><blockquote
cite="mid:523506.48216.qm@web31803.mail.mud.yahoo.com"type="cite"><pre wrap="">
 
Also at the risk of getting my head bitten off by someone more knowledgeable that disagrees :-), it is a good practice
toknow your database schema design well enough to know the names of your tables and columns.  It is also good practice
todirectly call out those column names in your code rather than simply guessing based on the field types.
</pre></blockquote>OK, I'll bite :)<br /> Since I created the tables I'm intimately familiar with the schema. Again,
thiswas supposed to be a quick and dirty data import.<br /><br /> Obviously there is a bug on either the MS ADO or in
thepsqlodbc30a.dll. Since the psqlodbc30a.dll is the one that produces the exception ("Access violation, Context:
PSQLODBC30A!06f49797(), 06F49797   mov         edx,dword ptr [edi+0Ch]"), that DLL is the prime suspect.<br /><br />
ButI do appreciate you taking the time trying to help! Pointing me to the log file really did help and I would think
thatwhoever maintains the psqlodbc30a.dll would be able to reproduce the error and fix the bug. Meanwhile I'll try
usingMS DAO and a DSN connection.<br /><br /> Finn<br /> 

Re: Need help with Visual Basic 6 and PostgreSQL

From
Richard Broersma Jr
Date:
--- On Thu, 11/22/07, Finn Lassen <dcio@AxiomInt.com> wrote:
> 2007-11-22 20:21:14 ERROR:  column "" of relation
> "Contact1"
> does not exist at character 40
>
> 2007-11-22 20:21:14 STATEMENT:  BEGIN;insert into
> "public"."Contact1" ("",
> "Ext4", "(", "Address2",

Does your table really have all of these field names?  In addition to the "" field, I am suspicious of the "(" field.
Iam curious, if the ado recordset is seeing more fields than the table actually has.  Since you weren't able to display
thefield that didn't exist in the table, you could possible determine if it is a ascii character by getting its
charcode()(orsomething equivalent). 

If you indeed find that your recordset does indeed see fields that do not exist in the table, then it is very likely
thatyou have found a bug with the ODBC driver. It would help the developers to correct this problem if you were to
submita small test case that is able to reproduce the effects that you are seeing.  It should include a sample database
withsample table and it should include the VB codes that creates the recordset and then attempts to send an update to
thetable.  They will probably want you to submit two of the ODBC drivers logs ( Mylog and Commlog ).  These can be
turnedON from your odbc drivers DSN user interface.  (Just remember to turn off all odbc logging when your testing is
donesince odbc logging is a major performance killer.) 

What version number of PostgreSQL are you running. What is the version number of the ODBC driver that you are using?
Arethey the latest released versions? 



Re: Need help with Visual Basic 6 and PostgreSQL

From
Finn Lassen
Date:
On 23 Nov 07 9:39 AM, Richard Broersma Jr wrote: <blockquote cite="mid:861905.97007.qm@web31812.mail.mud.yahoo.com"
type="cite"><prewrap="">
 
Does your table really have all of these field names?</pre></blockquote> Yes. In fact there are 40 fields, the first
four("AccountNo", "Company", "Contact" and "LastName") appear to be replaced by the illegal character.  The illegal
characteris 0FH. <br /><br /> Since it goes through the loop OK the first time, it is obviously a bug, and everything
pointsto the ODBC driver.<br /><blockquote cite="mid:861905.97007.qm@web31812.mail.mud.yahoo.com" type="cite"><pre
wrap=""> In addition to the "" field, I am suspicious of the "(" field.</pre></blockquote> There is no "(" field. The
"("is the SQL syntax for enumerating the fields to be populated. <blockquote
cite="mid:861905.97007.qm@web31812.mail.mud.yahoo.com"type="cite"><pre wrap="">  I am curious, if the ado recordset is
seeingmore fields than the table actually has.</pre></blockquote> Nope. I checked that.<br /><blockquote
cite="mid:861905.97007.qm@web31812.mail.mud.yahoo.com"type="cite"><pre wrap="">What version number of PostgreSQL are
yourunning. What is the version number of the ODBC driver that you are using?  Are they the latest released versions?
</pre></blockquote><prewrap="">pg_ctl.exe is version 8.2.5.7260
 
psqlodbc30a.dll is version 8.2.4.0

I downloaded them a couple of days ago, so I have to assume they are the latest.

How do I contact the developers?

Finn

P.S. Unfortunately I have already spent way more time on this than I can afford. This was supposed to be a quick
evaluationto determine which database to replace the Borland with. I really should move on to looking at MySQL.
 
</pre>

Re: Need help with Visual Basic 6 and PostgreSQL

From
Richard Broersma Jr
Date:
--- On Fri, 11/23/07, Finn Lassen <dcio@AxiomInt.com> wrote:
> There is no "(" field. The "(" is the
> SQL syntax for enumerating the
> fields to be populated.

>> 2007-11-22 20:21:14 STATEMENT:  BEGIN;insert into "public"."Contact1" ("", "Department", ..., "(", ... ) values
(E'93100765018597400Bru'...

Actually if you've noticed from this insert statement that you've previously posted, "(" is listed as a column name for
datato be inserted. This must be caused by either the ODBC or ADO driver is telling PostgreSQL to insert data into a
columnthat doesn't really exist.  My gut feeling is that this shouldn't be a problem caused by the ODBC driver hence my
suggestto specifically call out the column names of your table when you assign values to your fields. 

> P.S. Unfortunately I have already spent way more time on
> this than I can afford. This was supposed to be a quick
> evaluation to determine which database to replace the
> Borland with. I really should move on to looking at MySQL.

No arguments from me on this point.  MySQL is a very good RDBMS also, and depending upon your needs it should work out
wellfor you.  But if you later find that MySQL's features to not adequately satisfy some of you core development needs
youcould always give PostgreSQL a second try later on. 

Regarding getting in touch with the developers, some of the ODBC developers subscribe to this mailing list.  It could
bethat developers haven't had an opportunity to responded since this is a holiday weekend and may be unavailable. 

However, the ODBC project has an official web-page for developers and bug reporting.
http://pgfoundry.org/projects/psqlodbc/
http://pgfoundry.org/tracker/?func=add&group_id=1000125&atid=538

Also, 3rd party vendor (Command Prompt) has developed their own ODBC driver that is supposed to have a more aggressive
datacaching mechanism. I haven't used it since the Official ODBC driver has worked so well in my case.  You could see
ifthis driver produces different results. 

https://projects.commandprompt.com/public/odbcng/wiki/Downloads

They also have a mailing list dedicated to this driver:
http://lists.commandprompt.com/mailman/listinfo/odbcng

Regards,
Richard Broersma Jr.


Re: Need help with Visual Basic 6 and PostgreSQL

From
Finn Lassen
Date:
A basic question:
In a connection string, if you only specify a driver name ("PostgreSQL
ANSI"), instead of a DSN configured with the ODBC Data Source
Administrator, do any configuration changes made with the ODBC Data
Source Administrator affect the driver itself?
In other words, does registering an ODBC driver automatically make it
subject to any configurations made with ODBC Data Source Administrator?

I still don't understand the:
"ERROR: Column "oid" does not exist;"
I get when executing the " rsOut.Open ..." statement below.
Can the ODBC driver only handle tables with oid columns?

    Dim cn As ADODB.Connection
    Dim rsOut As ADODB.Recordset
    Set cn = New ADODB.Connection
    Set rsOut = New ADODB.Recordset
    With cn
        .ConnectionString = "Driver={PostgreSQL
ANSI};Server=localhost;Port=5432;Database=postgres;Uid=user;Pwd=secret;"
        .Open
        With rsOut
             rsOut.Open """Contact1""", dbOut, adOpenDynamic,
adLockOptimistic, adCmdTable

Finn


Re: Need help with Visual Basic 6 and PostgreSQL

From
Richard Broersma Jr
Date:
--- On Fri, 11/23/07, Finn Lassen <dcio@AxiomInt.com> wrote:
> In a connection string, if you only specify a driver name
> ("PostgreSQL
> ANSI"), instead of a DSN configured with the ODBC Data
> Source
> Administrator, do any configuration changes made with the
> ODBC Data
> Source Administrator affect the driver itself?

I am not sure, but I do know what my connection string gets stored as when I used a system DSN:


DSN=myDSNname;DATABASE=myDatabase;SERVER=myServer;PORT=5432;UID=myUserName;PWD=myPassWord;CA=d;A6=;A7=100;A8=4096;B0=254;B1=8190;BI=0;C2=dd_;;CX=1b103bb;A1=7.4-1

Maybe in you augmented your connection string using these values, it might help?

Re: Need help with Visual Basic 6 and PostgreSQL

From
"Thomas H."
Date:
> In other words, does registering an ODBC driver automatically make it
> subject to any configurations made with ODBC Data Source Administrator?

as i understand it: partly. i.e. the connection pooling configuration
options you specify in the ODBC Data Source Administrator is a global
setting.

> I still don't understand the:
> "ERROR: Column "oid" does not exist;"
> I get when executing the " rsOut.Open ..." statement below.
> Can the ODBC driver only handle tables with oid columns?

no. i have no problems accessing a DB with and without oids using this
connection string:

Driver={PostgreSQL

UNICODE};Server=yourserver;Port=5432;Database=yourdb;UID=youruser;pwd=yourpassword;TrueIsMinus1=1;BoolsAsChar=0;TextAsLongVarchar=1;UseDeclareFetch=0

>             rsOut.Open """Contact1""", dbOut, adOpenDynamic,
> adLockOptimistic, adCmdTable

try this:

rsOut.Open "SELECT * FROM ""Contact1""", dbOut, adOpenDynamic,
adLockOptimistic

the problem might be the adCmdTable recordset type.

regards,
thomas


Re: Need help with Visual Basic 6 and PostgreSQL

From
Richard Broersma Jr
Date:
--- On Fri, 11/23/07, Finn Lassen <dcio@AxiomInt.com> wrote:
> "ERROR: Column "oid" does not exist;"
> I get when executing the " rsOut.Open ..."
> statement below.

Here are some OID setting from ODBC driver manual:
...
OID Options:

Show Column: Includes the OID in SQLColumns. This is good for using as a unique identifier to update records if no good
keyexists OR if the key has many parts, which blows up the backend. 

Fake Index: This option fakes a unique index on OID. This is useful when there is not a real unique index on OID and
forapps which can't ask what the unique identifier should be (i.e, Access 2.0). 
...

Perhaps the odbc driver defaults to showing ODBC column.  In postgresql versions < 8.0 it was the default for every
tableto be given an OID (basically every row in any and all tables had a unique number that identified it). However, as
ofpostgresql 8.0, OID columns are no longer added to all table by default.  This could be causing the problem since the
ODBCdriver may be trying to select the OID column from your table even though it doesn't actually exist. 

I will look for the ODBC documention that describes that settings that you can pass to the ODBC driver in the
connectionstring. 

Regards,
Richard Broersma Jr.

Re: Need help with Visual Basic 6 and PostgreSQL

From
Richard Broersma Jr
Date:
<table border="0" cellpadding="0" cellspacing="0"><tr><td style="font: inherit;"><p>--- On Fri, 11/23/07, Richard
BroersmaJr <rabroersma@yahoo.com> wrote:<p>From the ODBC driver documentation, <p>here is the list of parameters
thatyou can pass to the driver.<br /><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"><font
size="5"><b>Howto specify as a connection option </b></font></font><table border="1" cellpadding="4" cellspacing="3"
style="page-break-inside:avoid" width="100%"><colgroup><col width="96" /><col width="80" /><col width="79"
/><tbody><tr><tdwidth="38%"><b><font size="4">Definition</font></b></td><td width="31%"><b><font
size="4">Keyword</font></b></td><tdwidth="31%"><font size="4"><b>Abbreviation</b></font></td></tr><tr><td
width="38%">Datasource description </td><td width="31%">Description </td><td width="31%">Nothing </td></tr><tr><td
width="38%">Nameof Server </td><td width="31%">Servername </td><td width="31%">Nothing </td></tr><tr><td
width="38%">Postmasterlistening port </td><td width="31%">Port </td><td width="31%">Nothing </td></tr><tr><td
width="38%">UserName </td><td width="31%">Username </td><td width="31%">Nothing </td></tr><tr><td width="38%">Password
</td><tdwidth="31%">Password </td><td width="31%">Nothing </td></tr><tr><td width="38%">Debug flag </td><td
width="31%">Debug</td><td width="31%">B2 </td></tr><tr><td width="38%">Fetch Max Count </td><td width="31%">Fetch
</td><tdwidth="31%">A7 </td></tr><tr><td width="38%">Socket buffer size </td><td width="31%">Socket </td><td
width="31%">A8</td></tr><tr><td width="38%">Database is read only </td><td width="31%">ReadOnly </td><td width="31%">A0
</td></tr><tr><tdwidth="38%">Communication to backend logging </td><td width="31%">CommLog </td><td width="31%">B3
</td></tr><tr><tdwidth="38%">PostgreSQL backend protocol </td><td width="31%">Protocol </td><td width="31%">A1
</td></tr><tr><tdwidth="38%">Backend enetic optimizer </td><td width="31%">Optimizer </td><td width="31%">B4
</td></tr><tr><tdwidth="38%">Keyset query optimization </td><td width="31%">Ksqo </td><td width="31%">B5
</td></tr><tr><tdwidth="38%">Send tobackend on connection </td><td width="31%">ConnSettings </td><td width="31%">A6
</td></tr><tr><tdwidth="38%">Recognize unique indexes </td><td width="31%">UniqueIndex </td><td width="31%">Nothing
</td></tr><tr><tdwidth="38%">Unknownresult set sizes </td><td width="31%">UnknownSizes </td><td width="31%">A9
</td></tr><tr><tdwidth="38%">Cancel as FreeStmt </td><td width="31%">CancelAsFreeStmt </td><td width="31%">C1
</td></tr><tr><tdwidth="38%">Use Declare/Fetch cursors </td><td width="31%">UseDeclareFetch </td><td width="31%">B6
</td></tr><tr><tdwidth="38%">Text as LongVarchar </td><td width="31%">TextAsLongVarchar </td><td width="31%">B7
</td></tr><tr><tdwidth="38%">Unknowns as LongVarchar </td><td width="31%">UnknownsAsLongVarchar </td><td width="31%">B8
</td></tr><tr><tdwidth="38%">Bools as Char </td><td width="31%">BoolsAsChar </td><td width="31%">B9 </td></tr><tr><td
width="38%">MaxVarchar size </td><td width="31%">MaxVarcharSize </td><td width="31%">B0 </td></tr><tr><td
width="38%">MaxLongVarchar size </td><td width="31%">MaxLongVarcharSize </td><td width="31%">B1 </td></tr><tr><td
width="38%">Fakesa unique index on OID </td><td width="31%">FakeOidIndex </td><td width="31%">A2 </td></tr><tr><td
width="38%">Includesthe OID in SQLColumns </td><td width="31%">ShowOidColumn </td><td width="31%">A3 </td></tr><tr><td
width="38%">RowVersioning </td><td width="31%">RowVersioning </td><td width="31%">A4 </td></tr><tr><td width="38%">Show
SystemTables</td><td width="31%">ShowSystemTables </td><td width="31%">A5 </td></tr><tr><td width="38%">Parse
Statements</td><td width="31%">Parse </td><td width="31%">C0 </td></tr><tr><td width="38%">SysTable Prefixes </td><td
width="31%">ExtraSysTablePrefixes</td><td width="31%">C2 </td></tr><tr><td width="38%">Disallow Premature </td><td
width="31%">DisallowPremature</td><td width="31%">C3 </td></tr><tr><td width="38%">Updateable Cursors </td><td
width="31%">UpdatableCursors</td><td width="31%">C4 </td></tr><tr><td width="38%">LF <-> CR/LF conversion
</td><tdwidth="31%">LFConversion </td><td width="31%">C5 </td></tr><tr><td width="38%">True is -1 </td><td
width="31%">TrueIsMinus1</td><td width="31%">C6 </td></tr><tr><td width="38%">Datatype to report int8 columns as
</td><tdwidth="31%">BI </td><td width="31%">Nothing </td></tr><tr><td width="38%">Bytea as LongVarBinary </td><td
width="31%">ByteaAsLongVarBinary</td><td width="31%">C7 </td></tr><tr><td width="38%">Use serverside prepare </td><td
width="31%">UseServerSidePrepare</td><td width="31%">C8 </td></tr><tr><td width="38%">Lower case identifier </td><td
width="31%">LowerCaseIdentifier</td><td width="31%">C9 </td></tr><tr><td width="38%">SSL mode </td><td
width="31%">SSLmode</td><td width="31%">CA </td></tr><tr><td width="38%">Extra options </td><td width="31%">AB </td><td
width="31%">Nothing</td></tr><tr><td width="38%">Abbreviate(simple setup of a recommendation value) </td><td
width="31%">CX</td><td width="31%">Nothing </td></tr></tbody></colgroup></table><br /></td></tr></table> 

Re: Need help with Visual Basic 6 and PostgreSQL

From
Finn Lassen
Date:
Thanks for all your help!

I finally broke down and dropped the table and recreated it WITH OID.
Now everything works, even with these simple strings:
       .ConnectionString = "Driver={PostgreSQL
ANSI};Server=localhost;Port=5432;Database=postgres;Uid=user;Pwd=secret,B1=128000"
        rsOut.Open """Contact1""", dbOut, adOpenDynamic, adLockOptimistic, adCmdTable

I don't understand the difference between "LongVarchar" and "Varchar", but I have to use B1 whether I use the ANSI or
UNICODEdriver. 
(Source content of the memo field I put into text data type can be more than 64K, so I choose 128000. The default is
8196,so it has to be increased.) 

Conclusion: Version 8.2.4.0 of psqlodbc30a.dll and psqlodbc30w.dll require tables WITH OID.
(The "OID Options, Show column" -- and presumably "ShowOidColumn" -- has no effect.)

Finn



--
Finn Lassen
Deputy CIO
Axiom
1805 Drew Street
Clearwater, Florida 33765
727-442-7774 voice
727-442-8344 fax
dcio@AxiomInt.com
www.AxiomInt.com



Re: Need help with Visual Basic 6 and PostgreSQL

From
Richard Broersma Jr
Date:
--- On Fri, 11/23/07, Finn Lassen <dcio@AxiomInt.com> wrote:
> I don't understand the difference between "LongVarchar" and
> "Varchar",
> but I have to use B1 whether I use the ANSI or UNICODE driver.
> (Content of the memo field I put into text data type can be more than
> 64K, so I choose 128000. The default is 8196, so it has to be increased.)

For what it is worth, Postgresql has a 1 Gb limit on the size of a text field. So if you know that you ascii chars are
8bits, then you should be able to store a little over 134,000,000 characters. 


> Conclusion: Version 8.2.4.0 of psqlodbc30a.dll and psqlodbc30w.dll
> require tables WITH OID.
> (The "OID Options, Show column" -- and presumably
> "ShowOidColumn" -- has
> no effect.)

I will try to spend some time to play with ADO record sets without using a DSN to see what happens and see with I can
comeup with. But in the mean time at least you can perform your test comparison. 

Re: Need help with Visual Basic 6 and PostgreSQL

From
Tom Lane
Date:
Richard Broersma Jr <rabroersma@yahoo.com> writes:
> For what it is worth, Postgresql has a 1 Gb limit on the size of a text field. So if you know that you ascii chars
are8 bits, then you should be able to store a little over 134,000,000 characters. 

Uh, the hard limit is 1 gigabyte, not 1 gigabit.

(Whether you can approach the limit with reasonable performance is
another question ... I wouldn't try it in a 32-bit machine, for sure.)

            regards, tom lane

Re: Need help with Visual Basic 6 and PostgreSQL

From
Richard Broersma Jr
Date:
--- On Fri, 11/23/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Uh, the hard limit is 1 gigabyte, not 1 gigabit.
Thanks for the clarification Tom.

Regards,
Richard