Valentina.GetDatabaseVersion() and remote database
Charles Yeomans
charles at declareSub.com
Wed Mar 14 16:54:37 CDT 2007
So you're saying that you get error -39 when you call
VDatabase.Open? This is a File Manager error , 'End of file'. If
you're looking for code to open a remote database, the following
works for me.
dim connection as new VConnection("localhost", "sa", "sa")
connection.Open
dim db as new VDatabase(connection)
dim f as new FolderItem("SomeDatabase")
db.Open f
db.Close
db = nil
connection.Close
connection = nil
Charles Yeomans
On Mar 14, 2007, at 5:05 PM, Stan Busk wrote:
>
> I fully agree but that doesn't respond why 'Open' or
> 'GetDatabaseVersion' works when called in the middle of the
> connection code and not when called from a method or a function. I
> can fully reproduce here. Actually I don't mind about what
> GetDatabaseVersion does right now, my main concern is finding out
> why a valentina function works well in the function where I open
> the connection and not on other. I took 'GetDatabaseVersion' as an
> example. If you prefer forget 'GetDatabaseVersion' and take 'Open'.
> I have the same exact problem with 'Open'. I get a #-39 exception
> on all 'Open'.
>
> stan
>
>> Now I'm not sure what you're talking about. GetDatabaseVersion
>> returns a value representing the db file format. If VServer
>> opened it, then the file format of that database has been upgraded
>> by VServer to the current file format. The only reason to use
>> GetDatabaseVersion is that you are about to open a local database,
>> and you want to check the file format first -- because if you let
>> Valentina open it, the file format will be upgraded to the current
>> one -- and you want perhaps to let the user confirm that it's okay
>> to upgrade.
>>
>> Charles Yeomans
>>
>>
>>
>> On Mar 14, 2007, at 4:35 PM, Stan Busk wrote:
>>
>>> Hi,
>>>
>>> Yes, but when opening a remote DB you pass a FolderItem to it,
>>> right? Valentina is supposed to recognize it is a remote DB as
>>> you have initiated VDatabase using the server-like constructor.
>>> It should work then. Anyway the point is it works on the place
>>> where you open the connection but not from a function you call
>>> from where you open the connection. I use global properties
>>> everywhere so it should work but it doesn't. The same happen with
>>> OPEN. It works from where you open the connection but not from a
>>> function you call passing the folderitem. I have tried all day
>>> and no way. The only possible way to open a file is thru a single
>>> method in the middle of the connection code...That means none of
>>> my 15 schema updates can be called.
>>>
>>> Stan
>>>
>>>> I think you're missing the point of
>>>> Valentina.GetDatabaseVersion. As I understand it, all that it
>>>> does is to read some bytes from the file represented by the
>>>> FolderItem and return the information. This functionality
>>>> should work no matter how Valentina is initialized. For a
>>>> remote database, you cannot of course represent a database on
>>>> the server as a FolderItem, in general. Thus
>>>> Valentina.GetDatabaseVersion does not make any sense in that
>>>> context.
>>>>
>>>> Unfortunately, the VDatabase interface is misleading.
>>>>
>>>> Charles Yeomans
>>>>
>>>>
>>>>
>>>>
>>>> On Mar 14, 2007, at 2:41 PM, Stan Busk wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Strange. The code below works:
>>>>>
>>>>> dbi = mValentinaServer.DatabaseInfo(1)
>>>>> myDb = new myDatabase( mVConnection )
>>>>> f = new FolderItem( dbi.path, FolderItem.PathTypeShell )
>>>>> DBVersion = Valentina.GetDatabaseVersion( f )
>>>>>
>>>>> but as soon as I call Valentina.GetDatabaseVersion( f ) from
>>>>> inside a method I get a Valentina Exception #-39. In other
>>>>> words, rather than calling DBVersion =
>>>>> Valentina.GetDatabaseVersion( f ) directly I have that function:
>>>>>
>>>>> Function Database_UpdateSchema( inFile As FolderItem )
>>>>> Dim DbVersion as Integer
>>>>> DbVersion = Valentina.GetDatabaseVersion( inFile )
>>>>> End Function
>>>>>
>>>>> I don't understand the point here.
>>>>>
>>>>> stan
>>>>>
>>>>>> On 12/3/07 8:18 PM, "Stan Busk" <maxprog at mac.com> wrote:
>>>>>>
>>>>>> Hi Stan,
>>>>>>
>>>>>>> Are the two last lines of the following code correct?
>>>>>>>
>>>>>>> ---
>>>>>>> mVConnection = new VConnection( aHost, aUserName, aPassword,
>>>>>>> aPort,
>>>>>>> aTimeOut, aParameter )
>>>>>>> mVConnection.Open()
>>>>>>> mValentinaServer = new VServer( mVConnection )
>>>>>>>
>>>>>>> dbi = mValentinaServer.DatabaseInfo(1)
>>>>>>>
>>>>>>> myDb = new myDatabase( mVConnection )
>>>>>>>
>>>>>>> f = new FolderItem( dbi.path, FolderItem.PathTypeShell )
>>>>>>>
>>>>>>> DBVersion = Valentina.GetDatabaseVersion( f )
>>>>>>> ---
>>>>>>
>>>>>> Not a fact this is correct.
>>>>>> Db already should be registered under VSERVER.
>>>>>>
>>>>>>> I am just trying to get the served DB version. It works fine
>>>>>>> when the
>>>>>>> database in on localhost but I have doubts that would work on
>>>>>>> remote
>>>>>>> DBs as well unless Valentina is clever enough to just use the
>>>>>>> DB name
>>>>>>> and already know what and where to look at. It looks like the
>>>>>>> Open()
>>>>>>> method is already that clever.
>>>>>>
>>>>>> Right. Open() opens db by name as it is registered under vserver
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Best regards,
>>>>>>
>>>>>> Ruslan Zasukhin
>>>>>> VP Engineering and New Technology
>>>>>> Paradigma Software, Inc
>>>>>>
>>>>>> Valentina - Joining Worlds of Information
>>>>>> http://www.paradigmasoft.com
>>>>>>
>>>>>> [I feel the need: the need for speed]
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Valentina mailing list
>>>>>> Valentina at lists.macserve.net
>>>>>> http://lists.macserve.net/mailman/listinfo/valentina
>>>>>
>>>>> _______________________________________________
>>>>> Valentina mailing list
>>>>> Valentina at lists.macserve.net
>>>>> http://lists.macserve.net/mailman/listinfo/valentina
>>>>
>>>> _______________________________________________
>>>> Valentina mailing list
>>>> Valentina at lists.macserve.net
>>>> http://lists.macserve.net/mailman/listinfo/valentina
>>>
>>> _______________________________________________
>>> Valentina mailing list
>>> Valentina at lists.macserve.net
>>> http://lists.macserve.net/mailman/listinfo/valentina
>>
>> _______________________________________________
>> Valentina mailing list
>> Valentina at lists.macserve.net
>> http://lists.macserve.net/mailman/listinfo/valentina
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
More information about the Valentina
mailing list