Windows 7 64-bit issue

MLDatabase allows MLServer3 to interact with any ODBC database that you create or attach to. Intended for advanced users only.
User avatar
hakha4
Member
Member
Posts: 88
Joined: Wed Dec 24, 2008 3:18 am
Location: Moholm Sweden
Contact:

Windows 7 64-bit issue

Postby hakha4 » Tue Jan 11, 2011 2:59 pm

My MLServer is located in a win 7 64-bit Pc and everything works ok except connecting to database via vbscript.
I've downloaded free driver for 32/64 bit ODBC-connection from Microsoft (http://www.microsoft.com/downloads/deta ... laylang=en)
for connecting to Access database and Ican run script from outside MLServer ok but not from the vbscript plugin. I've downloaded MLDatabase and the same problem here. Has anyone else this problem? Suggestion for solution?

Example script that runs ok outside MLSERVER

Code: Select all


'script to test connection

Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Set objConnection = CreateObject("ADODB.Connection")

Set objRecordset = CreateObject("ADODB.Recordset")

'Works ok outside MLServer
objConnection.Open _
"Provider = Microsoft.ACE.OLEDB.12.0;" & _
"Data Source = Switchking.mdb"

'Open via DSN works ok outside MLServer
'objConnection.Open "DSN=SwitchKing_MLdata;"
objRecordset.CursorLocation = adUseClient

objRecordset.Open "SELECT * FROM MLRF",objConnection,adOpenStatic, adLockOptimistic
   
strSearchCriteria = "ID = '17'"
objRecordSet.Find strSearchCriteria
If objRecordset.EOF Then
    Msgbox "Record cannot be found."
Else
    Msgbox  "Record found."
End If

objRecordset.Close
objConnection.Close


User avatar
CinemarDave
Site Admin
Site Admin
Posts: 10533
Joined: Fri Feb 07, 2003 8:56 am
Location: Planet Earth
Contact:

Re: Windows 7 64-bit issue

Postby CinemarDave » Tue Jan 11, 2011 3:06 pm

You probably need to supply the full path to Switchking.mdb unless it is in the plugins folder and that is not recommended.

User avatar
hakha4
Member
Member
Posts: 88
Joined: Wed Dec 24, 2008 3:18 am
Location: Moholm Sweden
Contact:

Re: Windows 7 64-bit issue

Postby hakha4 » Tue Jan 11, 2011 3:11 pm

The mdb-file is located in same folder as script for testing just to make sure that it's not a path issue and it works ok outside MLServer so that's not the problem

User avatar
CinemarDave
Site Admin
Site Admin
Posts: 10533
Joined: Fri Feb 07, 2003 8:56 am
Location: Planet Earth
Contact:

Re: Windows 7 64-bit issue

Postby CinemarDave » Tue Jan 11, 2011 3:41 pm

When running from within MLServer MLScript's path is the plugins folder. Humor me and put the full path in to see if it makes a difference.

User avatar
hakha4
Member
Member
Posts: 88
Joined: Wed Dec 24, 2008 3:18 am
Location: Moholm Sweden
Contact:

Re: Windows 7 64-bit issue

Postby hakha4 » Tue Jan 11, 2011 3:54 pm

I've tried with full path but don't work from script run from MLServer but runs outside,se code below. I've save my scripts under ..\MLServer\scripts and put the mdb-file there temporary for test

Code: Select all

Sub FindRecord(Params)
dim sFile
dim objConnection
dim objRecordset
dim strSearchCriteria


Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3

 sFile = "C:\Program Files (x86)\MLServer\Scripts\Switchking.mdb"

msgbox sFile

Set objConnection = CreateObject("ADODB.Connection")

Set objRecordset = CreateObject("ADODB.Recordset")

  objConnection.Open _
  "Provider = Microsoft.ACE.OLEDB.12.0;" & _
  "Data Source = C:\Program Files (x86)\MLServer\Scripts\Switchking.mdb "

'**************************************************************************
' objConnection.Open "DSN=SwitchKing_MLdata;"
msgbox "here"
'objRecordset.CursorLocation = adUseClient

' objRecordset.Open "SELECT * FROM MLRF",objConnection,adOpenStatic, adLockOptimistic
   
strSearchCriteria = "ID = '17'"
objRecordSet.Find strSearchCriteria
If objRecordset.EOF Then
    msgbox "Record cannot be found."
Else
    msgbox "Record found."
End If

objRecordset.Close
objConnection.Close

End Sub



User avatar
hakha4
Member
Member
Posts: 88
Joined: Wed Dec 24, 2008 3:18 am
Location: Moholm Sweden
Contact:

Re: Windows 7 64-bit issue

Postby hakha4 » Wed Jan 12, 2011 1:27 pm

Find the solution ,DSN must be set with 'C:\Windows\SysWOW64\odbcad32.exe' and not the default odbcad.exe for 64 bit !
Anyway thanks for replying

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Re: Windows 7 64-bit issue

Postby bigDvette » Wed Jan 12, 2011 7:12 pm

makes sense considering MLServer is 32bit so it is using 32bit libraries.


Return to “MLDatabase”

Who is online

Users browsing this forum: No registered users and 1 guest