Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Should there always be an index.ddf, file.ddf and field.ddf? 1

Status
Not open for further replies.

sheldog

Programmer
Jan 20, 2005
3
US
I need help understanding file types in Pervasive.
I have a client who ask me to help them with their Pervasive database.
I have never worked with Pervasive but told them I will help.
Client zipped the files and sent the to me.
It contains 1 folder there are 8 files with .MKD and 1 file with .DCT extension and nothing with .ddf.
Should there always be an index.ddf, file.ddf and field.ddf?
 
No. There doesn't always need to be DDFs. DDFs are only needed for ODBC/OLEDB/PDAC/ActiveX/JDBC interfaces. Btrieve API programs do not need DDFs and will not use them. There is an exception to this rule. If you are using Pervasive.SQL V8.5/8.6 and you are using database security. In that case, DDFs are required even for Btrieve API access.


Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.
 
Mirtheil, thanks for your input...
I read one of your post that refrences I made a new project in vb.net 2003 and added this code below. If I am trying to access the demodata on my local machine what all do I need to do to make this work? I read in one of the helpdoc from pervasive it mentions go to menu / projects / add reference / com microsoft activex data objext 2.1 or 2.5 ... i did that and the error from the dim con as new adodb.conneciton went away.. but I still have error on adStateOpen, adCmdText and Debug.Print are still there... can you point me in the correct direction?



Dim con As New ADODB.Connection
Dim rstH As New ADODB.Recordset
Dim sConStr As String
con.Open "Provider=PervasiveOLEDB;Data Source=demodata"
If con.State <> adStateOpen Then
Set con = Nothing
Set rstH = Nothing
MsgBox "could not connect"
End
End If
rstH.Open "select * from room", con, , , adCmdText
rstH.MoveFirst
Do
Debug.Print rstH!Building_Name
rstH.MoveNext
Loop Until rstH.EOF
rstH.Close
con.Close
Set rstH = Nothing
Set con = Nothing
MsgBox "Done
 
First off, the code you posted is for VB6. For VB.NET, you'll need to change it a bit.
If you are going to use VB.NET, I would suggest either OLEDB, ODBC, or the Pervasive Managed Provider. I would recommend the Managed Provider since it seems everything is moving to Managed code. TO use any of those interfaces, you'll need DDFs (FILE, FIELD, and INDEX at least) plus the data files. Here's some VB.NET code I've used. It uses the Pervasive Managed Provider.
Code:
        Dim conn As New PsqlConnection("ServerDSN=DEMODATA")
        conn.Open()
        Dim strCommand As String = "select * from class"
        Dim cmd As New PsqlCommand(strCommand, conn)
        Dim dr As PsqlDataReader
        dr = cmd.ExecuteReader()
        Dim i As Integer
        Do While dr.Read()
            For i = 0 To dr.FieldCount - 1
                Console.WriteLine(i & ":" & dr.GetString(i))
            Next
        Loop
        conn.Close()
Here's the same code using OLEDB:
Code:
        Dim conn As New OleDbConnection("Provider=PervasiveOLEDB;Data Source=DEMODATA")
        conn.Open()
        Dim strCommand As String = "select * from class"
        Dim cmd As New OleDbCommand(strCommand, conn)
        Dim dr As OleDbDataReader
        dr = cmd.ExecuteReader()
        Dim i As Integer
        Do While dr.Read()
            For i = 0 To dr.FieldCount - 1
                Console.WriteLine(i & ":" & dr.GetString(i))
            Next
        Loop
        conn.Close()
and the same code using ODBC:
Code:
        Dim conn As New OdbcConnection("DSN=DEMODATA")
        conn.Open()
        Dim strCommand As String = "select * from class"
        Dim cmd As New OdbcCommand(strCommand, conn)
        Dim dr As OdbcDataReader
        dr = cmd.ExecuteReader()
        Dim i As Integer
        Do While dr.Read()
            For i = 0 To dr.FieldCount - 1
                Console.WriteLine(i & ":" & dr.GetString(i))
            Next
        Loop
        conn.Close()
Hope this helps.

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.
 
I get error when I past your code type PsqlConnection is not defined? Do I need to add a reference?

Also, is there easy way to recreate the ddf files?
I have 1 .dct file and many .mkd files in a folder called pei_dat
and out side the folder I have a file called pei.dat?




 
Yes, you need to add the Pervasive.Data.SqlClient reference. That's the Pervasive Managed Provider. You may have to download it from Pervasive's site.
As far as creating DDFs, if you want to add a table, you don't need to recreate them, just use the Create Table Wizard or Create Table SQL statements or a third party DDF Builder like BtSearch32 (I haven't used BtSearch so I can't tell you if it's good or not).


Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top