Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sqlite Password support

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Data Objects Support
View previous topic :: View next topic  
Author Message
WaqasK



Joined: 21 Oct 2006
Posts: 32

PostPosted: Mon Oct 12, 2009 8:43 pm    Post subject: sqlite Password support Reply with quote

Hi,

I have an application which uses SQLite as the backend db. The db is encrypted with a password I enter each time I want to open a connection. Below is the code I use top open a ODBC connection to the DB:
Code:

SQLiteConnection cnn = new SQLiteConnection("Data Source=c:\\test.db3")
cnn.SetPassword("myPass")
cnn.Open()


This works fine. However, when I try to connect using VDO objects using this code:

db.open("DRIVER=SQLite3 ODBC Driver;Database=c:\\test.db3;option=3;Password=myPass;)

I get the following error:
Quote:

file is encrypted or is not a database (26)

" at ADODB.RecordsetClass.Open(Object Source, Object ActiveConnection, CursorTypeEnum CursorType, LockTypeEnum LockType, Int32 Options)
at Infralution.VirtualData.VirtualConnection.GetRecordset(String query)"


Note that I have no problems using the connection string above when the DB is not password protected.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Oct 12, 2009 10:20 pm    Post subject: Reply with quote

Quote:
db.open("DRIVER=SQLite3 ODBC Driver;Database=c:\\test.db3;option=3;Password=myPass;)


I'm not sure what method you are calling - since VirtualConnection does not have an "open" method. If you are passing that connection string to the VirtualConnection class constructor then you might want to try removing the password part from the connection string and passing the password to the separate password parameter ie:

Code:
VirtualConnection vc = new VirtualConnection(
    "DRIVER=SQLite3 ODBC Driver;Database=c:\\test.db3;option=3;",
    null,           // user id
    "myPass",  // password
    -1,             //options
    10);           // record cache set size


If you are still having problems try creating the ADO connection and opening a recordset directly eg

Code:
con = new ADODB.ConnectionClass();
con.CursorLocation = ADODB.CursorLocationEnum.adUseServer;
con.Open"DRIVER=SQLite3 ODBC Driver;Database=c:\\test.db3;option=3;",  null, "myPass", -1);
ADODB.Recordset rs = new ADODB.RecordsetClass();
rs.Open("SELECT * FROM MyTable", con, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockOptimistic, -1);


If you can't get ADO to open the recordset with your connection string then you won't get VDO to work.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Data Objects Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group