Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


Pervasive v8 database - Data source name too long

Pervasive v8 database - Data source name too long

I have been trying to connect and read data from a Pervasive v8 database.
I have created a DSN which tests successfully.
Initially, I was creating a VB script to read the database and transfer the data to another database.
 The connection opens successfully both using a DSN or connection string.
When the code gets to opening a recordset. I get the following error.
Run-time error -2147457259 (800004005)
[Microsoft][ODBC Driver Manager] Data source name too long
Function Retrieve_Vendor_Data()
   Dim pCnn, pRst, Cnn, Rst
   Set pCnn = CreateObject("ADODB.Connection")
   Set pRst = CreateObject("ADODB.Connection")
   Const adStateClosed = 0
   Const adOpenStatic = 3
   Const adUseClient = 3
   Const adLockBatchOptimistic = 4
   Dim bVendorExists
   Dim iNextID
'Retrieve Data from Vendor Table
If pCnn.State = adStateClosed Then
   'pCnn.Open "DSN=APACC;"
   pCnn.Open "Provider=PervasiveOLEDB;Data Source=U:\Vol_1\ACTW\APDSN;"
End If
pRst.Open "SELECT * FROM Vendors WHERE number like '[A-Z]%' order by number", pCnn
Point of error
Connection Strings that are returned
pCnn.Open "DSN=APACC;"
Provider=MSDASQL.1;Extended Properties="DSN=APACC;ServerName=;
pCnn.Open "Provider=PervasiveOLEDB;Data Source=U:\Vol_1\ACTW\APDSN;"
Provider=PervasiveOLEDB.8.70;Data Source=apacc;Location=;Cache Authentication=False;Encrypt Password=False;Mask Password=False;Persist Encrypted=False;Persist Security Info=False;Impersonation Level=Anonymous;Mode=ReadWrite;Protection Level=None;Auto Translate=False;Port=1583;Pessimistic Read Lock=False;CommandOnly=False;DirectOnly=False;
Any Ideas?

RE: Pervasive v8 database - Data source name too long

First off, do all of the connection strings you've posted display the error you are seeing?  
Second, what happens if you change the SQL used for the pRst.Open call?  Change it to "SELECT * FROM Vendors" and try it.  Does it still fail?
All of the connection strings look fine.  

Certified Pervasive Developer
Certified Pervasive Technician

RE: Pervasive v8 database - Data source name too long

Thanks for the reply.

Yes, All the connection strings show the same error.
And the error still occurs if the SQL Statement is reduced to 'select * from vendors'

I don't know what to look at next. I have verified the database engine is the same.

RE: Pervasive v8 database - Data source name too long

Does this VBScript work:


Dim objConn
dim rsTemp
dim sHeaders
dim sRecords
dim filOutput
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Set filOutput = fso.CreateTextFile("class.csv", True)
Set objConn = CreateObject("ADODB.Connection")
objConn.Open "DSN=demodata"
mySQL = "Select * from class"
set rstemp=objConn.Execute(mySQL)
if rstemp.eof then
    filOutput.Write "No records matched" & chr(13)
    filOutput.Write mySQL & chr(13) & "So cannot make table..."
    set filOutput=nothing
    set fso=nothing
    set objConn=nothing
end if

for each whatever in rstemp.fields
      sHeaders = sHeaders & chr(34) & & chr(34) & ","
sHeaders = left(sHeaders, len(sHeaders) -1)
filOutput.WriteLine sHeaders
DO UNTIL rstemp.eof
    for each rec in rstemp.fields
      if isnull(thisfield) then
      end if
      if trim(thisfield)="" then
      end if
      sRecords = sRecords & chr(34) &  thisfield & chr(34) & ","
    sRecords = left(sRecords, len(sRecords) -1)
    filOutput.WriteLine sRecords
    sRecords = ""
set rstemp=nothing
set objConn=nothing
set filOutput=nothing
set fso=nothing

Certified Pervasive Developer
Certified Pervasive Technician

RE: Pervasive v8 database - Data source name too long

Thanks I got that to work and substituted the code I needed in place.

RE: Pervasive v8 database - Data source name too long

That's good to hear. What was the problematic code?  

Certified Pervasive Developer
Certified Pervasive Technician

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close