Microsoft Search Service: Is there an OLE DB provider? (alternate: Index Server on Win2012?) - microsoft-search-server

(From my research, Index Server no longer exists on Win2012 -- If this is mistaken, tell me how to set it up!)
Moving a nice .asp application from Win2003 server to Win2012. This app makes heavy use of Index Server via the OLE DB driver for index server.
Example of how we use it:
StrSQL="SELECT size, doctitle, vpath, filename, size, write, " & _
"characterization, path, rank FROM SCOPE() " & _
"WHERE CONTAINS('"searching words"') " & _
"AND vPath LIKE '%Knowledgestore%'" " & _
"AND (filename like '%TXT')" & _
"ORDER BY rank DESC"
Set ixQuery = Server.CreateObject("ADODB.Connection")
Set QueryRS = Server.CreateObject("ADODB.RecordSet")
ixQuery.Open "provider=msidxs;Data Source=knowledgestore"
QueryRS.Open strSQL,ixQuery
How do I do this against Microsoft Search Service?
Is there an OLE DB provider for Search Service?
If not, what is the appro way to access Search Service from VBA/ASP/Python?

use Provider=Search.CollatorDSO;Extended Properties='Application=Windows'; as connectionstring.

After lots of digging around, the answer has been found.
Downloading and installing Windows Search Server does not install the OLE DB provider. Neither does installing the Windows SDK. The provider is installed when the Windows Search Service is installed.
On Win7/8 desktop OS, this is installed by default (I believe). On server, you have to enable the feature.

Related

Connect to online mySQL database using VBA

Objective:
I'm trying to connect to a database (e.g. associated with a website hosted by goDaddy) via VBA; using MS Word. I would like to distribute the VBA code via a word template so that others can also connect to my database.
Current Understanding - Is it correct?
In order to connect to a remote mySQL database I MUST configure a ODBC Data Source using (for example) mySQL Connector/ODBC (available here)?
There seems to be a way to connect without using a DSN as suggested here.
Issue:
I have been trying to use the mySQL Connector tool and am attempting to configure it with the information I have at hand. Steps taken:
download connector tool from dev.mysql.com
Control Panel > System & Security > Administrative Tools > ODBC Data Sources 64 Bit
add host: www.mywebsite.com
add user: NameOfDataBaseUser
add pwrd: PWForUser
I get the impression that I am using the wrong credentials... I found some documentation that said a list of DataBases would be displayed if connection is successful. That suggests to me that I should be using credentials for a master user - which user would that be?
Disclaimer
I do plan to connect to an online DB via VBA, but suspect that it might be better to connect indirectly via a php web-page.
If anyone has thoughts on this (security, ease of deployment, other) please let me know, it would probably be a new question. Other disclaimer, I am highly INexperienced with databases but keen to learn - slowly ;-)
I am currently working on a project with Excel where I am successfully connecting to a remote MySQL database.
I am using the DSN-less approach and this could probably work well for you, too:
Set remoteCon = New ADODB.Connection
conStr = "DRIVER={MySQL ODBC 5.3 Unicode Driver};" & _
"SERVER=myhomepage.com;PORT=3306;DATABASE=mydb;" & _
"UID=username;PWD=secret"
remoteCon.Open conStr
remoteCon.Execute ("USE mydb;")
In order for this to work, you also have to add a reference (in VBA backend): Tools > References > Check "Microsoft ActiveX Data Objects x.x Library".
You also need to have the MySQL ODBC Driver (in my case "MySQL ODBC 5.3 Unicode Driver") installed on your computer.
Queries can then be executed like this:
Dim rs As ADODB.Recordset
Set rs = remoteCon.Execute("SELECT * FROM table")
If Not rs.BOF And Not rs.EOF Then
result = rs.GetRows
End If
How to connect VBA to a Remote mySQL DataBase using ODBC
Thanks to #EVilliger & #tobifasc for your help with this, there are many 'how to configure mySQL questions' floating around but none that solved my (larger) issue.
Basic problem - my host does NOT allow remote connections to the database, except for from a single white-listed IP (this seems fairly common).
Questions Answered:
It turns out that you do NOT need to configure the mySQL connection using the connector, however you DO NEED to have an appropriate ODBC driver installed. The connector (with the driver) can be found here: https://dev.mysql.com/downloads/connector/odbc/
I uninstalled the mySQL Connector and everything seemed to continue working, until it didn't. Conclusion don't uninstall the mySQL Connector unless you have something to replace it with.
The credentials to use can be for a database user, not some elevated user.
For anyone interested in setting up and experimenting with mySQL from VBA here is a way forward:
Download & install the drivers (see above) - if the install fails you may need to install vcredist_x64.exe
Set-up a free mySQL database, I used HelioHost: https://www.heliohost.org/ (they will also give you a domain)
Create a database & user in HelioHost cPanel
Configure remote access - use wildcard % to allow all IPs
Add user to database
Use the following code to connect...
Code from accepted answer:
Sub connect2OnlineSQL()
' Note: add referecne to Microsoft ActiveX Data Objects #.# Library
' Tools > References > (scroll down...)
Set remoteCon = New ADODB.Connection
conStr = "DRIVER={MySQL ODBC 5.3 Unicode Driver};" & _
"SERVER=something.heliohost.org;PORT=3306;DATABASE=db_name;" & _
"UID=db_user;PWD=yourPassWordHere"
remoteCon.Open conStr
remoteCon.Execute ("USE db_name;")
End Sub
Thanks again :)
Following solution worked for me
Prerequisite:
Under Developer ->Tools->Reference Add the relevant Plug in for Oracle
Download and install ODBC Driver version for Oracle which you are using (32bit/64 bit)
Windows search -> ODBC Data Source -> Add Oracle driver under user DSN and System DSN
Copy paste below code which I used for MySQL and change the parameter based on your requirement
Sub ConnectToDB()
dbName = InputBox("Enter DB Name")
'Connection To MySQL
Dim oConn As ADODB.Connection
Dim str As String
str = "DRIVER={MySQL ODBC 8.0 Unicode Driver};SERVER=localhost;DATABASE=Employeeportal;PORT=3306;UID=root;PWD=root;"
Set oConn = New ADODB.Connection
oConn.Open str
MsgBox "Connected to MySQL DB"
'Exporting result set to Excel
Dim query As String
query = "select * from " & dbName
Dim recordSet As New ADODB.recordSet
recordSet.Open query, oConn
Sheet1.Range("A1:D1").CopyFromRecordset recordSet
oConn.Close
End Sub

Excel-Vba Connect Mysql localhost failed

Trying to implement Excel VBA: writing to mysql database.
Following code runs into a run-time error [MIcrosoft][ODBC Driver Manager] Data source name not found and no default driver specified
Dim cn As Object
Sub Connect()
Dim strCon as string
Set cn = CreateObject("ADODB.connection")
strCon = "DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=localhost;" & _
"DATABASE=dbname;" & _
"USER=root;" & _
"PASSWORD=mypass;" & _
"Port=3306;" & _
"Option=3"
cn.Open strCon
cn.Close
End Sub
checked connection parameters with the following php code
$mysqli = new mysqli('localhost','root','mypass','dbname');
and all works just fine.
I do have Microsoft ActiveX Data Objects 2.8 Library ticked in my VBA Project References.
Any help is welcomed.
For whatever it's worth at this point (since I just ran into it and it took me a day to figure it out):
You may have MySQL (or other Database/Application) in either 32 bit or 64 bit form.
You may have Excel (or other application) in either 32 or 64 bit form.
You may have the ODBC "connection" between the two in either 32 or 64 bit form.
Typically, the ODBC driver will be installed when you install the DB product, so it will be the same as the database.
Unfortunately, that's not important.
What IS important is that the ODBC driver match the application (e.g., Excel) properly.
If you have 32 bit Excel, and install 64 bit MySQL, that's fine, but Excel won't be able to connect to MySQL (except through the MySQL Connector, but that's not the goal here).
You won't be able to write an Excel app to read, via ODBC, from the database.
The solution is simple. Download the MySQL ODBC driver for 32 bit (same place as MySQL), and install it.
(It will tell you 'already installed' - because it will see the 64 bit version - and ask if you want to uninstall. Say Yes.)
Now, 32bit Excel can talk to 32bit ODBC driver, which can talk to 64bit MySQL, to exchange data.
Note: Far as I know, you can only install one type of ODBC driver (per DB App). So, if you are using the 64bit version, perhaps for some other app, you'll have to uninstall it (which breaks access to that App) to install the 32bit version so you can use Excel.
I have a 64 Win machine with 32bit Excel. I experimented with different MySQl ODBC drivers (5.1, 5.2, 5.3). The 64bit drivers did not work fro me, but the 32bit odbc driver did work.
Somewhere in the Microsoft knowledgebase it mentioned that Excel does not work with the 64bit drivers.
I recommend using a more recent one than the one you mentioned in your post:
http://dev.mysql.com/downloads/connector/odbc/5.2.html
This vba code worked for me
Set oConn = New ADODB.Connection
With oConn
.ConnectionString = "Driver={MySQL ODBC 5.2 Unicode Driver};" & _
"Server=" & strServer & ";Port=3306;" & _
"Database=" & strDBName & ";" & _
"Uid=" & strUserID & ";" & _
"Pwd=" & strPasswd & ";Option=3;"
.open
end with

Cannot connect to remote MySQL with VB6 (10060)

I got a hosting plan from GKG.net and I have a VB6 connection string to remotely reach MySQL database in it. I followed all instructions and tutorials about how to reach MySQL server remotely. Everything was fine till i get an error that says:
[MySQL][ODBC 3.51 Driver] Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (10060)
I searched for a solution over the net for hours but still there is nothing makes sense about it.. I double checked my connections.. I can ping to my static ip, but cant reach the MySQL server in it.
From CPanel i can reach my db with phpMyAdmin. I tested my db and there was nothing wrong with it. Everything seems right. Except i still get the error message with VB6
My connection string:
Dim conn As ADODB.Connection
Dim constr As String
Private Sub OpenServer()
Set conn = New ADODB.Connection
constr = "Driver={MySQL ODBC 3.51 Driver};" & _
"PORT=" & db_port & ";" & _
"SERVER=" & db_server & ";" & _
"DATABASE=" & db_name & ";" & _
"UID=" & db_user & ";" & _
"PWD=" & db_pass & ";" & _
"OPTION=3;" & _
"STMT=;"
conn.Open constr
End Sub
So how can i resolve this damned connection issue? and
What are the odds that causes this?
Hosts where you access their database server very rarely allow remote access to the database from outside their hosting environment (I have never seen it).
If you setup the MySql database yourself (on a dedicated or virtual server plan) then you should be able to set it up to accept remote hosts. In that case you need to modify your my.con file to allow remote hosts (you can also do it via the MySql Admin tools) and you need to grant the login you are trying to use access from the remote IP:
http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html
Your previous comment about SQLyog is a very good idea. And I can vouch for that product. It is a great tool. The free admin tools from MySql (Workbench - http://www.mysql.com/downloads/workbench/) are also decent and will allow you to test remote access as well.
check this Solution to Connecting remotely when you get Error 10060
http://forums.mysql.com/read.php?34,49742,239961
http://www.bigresource.com/VB-Remote-MySQL-Server-h6Z8Cbaszz.html#
MySQL is setup to handle remote connections very easily. However, you must setup MySQL to allow your users in. The other thing to do, is make sure port 3306 is open on the host. If it is not, then you can't connect to MySQL. The easiest way to do this is to...
telnet myhost 3306
If you get something back like...
,
3.23.54-log▬I_&:309i☻
then port 3306 is open and MySQL is listening.
Next, make sure your userid is setup to allow access on the MySQL server. You can do this with the mysql client software, or the mysqlcc software.
Hope this helps
I had this problem. I could connect from localhost but not from a client computer. I turned off Windows firewall (windows 8). However, no joy. I then created a new rule in firewall advanced settings and BINGO it worked. The new rule just allowed incoming connections on port 3306 on my private network.
Another approach for VB6. I use it like this in all my apps and its been working for years.
Dim StoreDB As ADODB.Connection
On Error Resume Next
Set StoreDB = New ADODB.Connection
StoreDB.Open "Driver={MySQL ODBC 3.51 Driver};Server=000.000.000.000;Port=3306;Database=yourDBName;User=Someusername;Password=Somepassword;OPTION=8;"
If Err.Number = 0 Then
[VB6 Code to execute]
Else
myErrorString = Err.Description
End If
StoreDB.Close
Set StoreDB = Nothing
As mentioned, ensure port is 3306. I have a host that uses 3307. I see no problem with your code. You probably need to sort this with the host.
Add mysqlid.exe into your windows firewall settings to access your server remotely

How to connect vb.net on my mysql database with windows 7

I have some problems with a vb.net application.
My application was perfectly working on XP, but now on my windows 7, each time I want to connect to localhost, I have a driver problem (in french, that's why I don't put it here)...
Do you know were does it come from?
My odbc driver is up to date...
Download and install Connector/.NET.
In your project, you should be able to add a reference to MySql.Data. You can then create your connection string.
Dim oMySqlConn As MySqlConnection = New MySqlConnection()
oMySqlConn.ConnectionString = "Data Source=localhost;" & _
"Database=mySQLDatabase;" & _
"User ID=myUsername;" & _
"Password=myPassword;" & _
"Command Logging=false"
oMySqlConn.Open()
localhost can be replaced with either an IP address or 'servename.com'

VBScript & Access MDB - 800A0E7A - "Provider cannot be found. It may not be properly installed"

I've having a problem with a VBScript connecting to an access MDB Database. My platform is Vista64, but the majority of resources out there are for ASP/IIS7.
Quite simply, I can't get it to connect. I'm getting the following error:
800A0E7A - "Provider cannot be found. It may not be properly installed"
My code is:
Set conn = CreateObject("ADODB.Connection")
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\database.MDB"
conn.Open strConnect
So far I have ran %WINDIR%\System32\odbcad32.exe to try to configure the Driver in 32bit mode, but it hasn't done the trick. Any suggestions would be greatly appreciated
Just as an addition, I'm trying to get this .vbs script to run by double clicking and letting it do it's thing. This code isn't embedded into another lang/script.
run script with SysWOW64 version
C:\Windows\SysWOW64\wscript.exe or cscript
instead of the default 64bit version from C:\Windows\System32
On Microsoft TechNet Configuring IIS to Run 32-bit Applications on 64-bit Windows (IIS 6.0):
To enable IIS to run 32-bit applications on 64-bit Windows:
Open a command prompt and navigate to the %systemdrive%\Inetpub\AdminScripts directory.
Type the following command:
cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 "true"
Press ENTER.
Alternatively, via Internet Information Services (IIS) Manager:
Access Application Pools
Right click on "ASP.NET v4.0 Classic"
Select "Set Application Pool Defaults ..."
Under General change "Enable 32-Bit Applications" from "False" to "True"
Click OK
If you wish to run both 32-bit and 64-bit applications, there's various blogs to do it, such as Rakki Muthukumar's blog IIS7 - Running 32-bit and 64-bit ASP.NET versions at the same time on different worker processes.
Alternatively, via Internet Information Services (IIS) Manager:
Access Application Pools
Right click on "ASP.NET v4.0 Classic"
Select "Set Application Pool Defaults ..."
Under General change "Enable 32-Bit Applications" from "False" to "True"
Click OK
When I change this settings it is worked. thank you guys.. :)
Just use
strConnect = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= "
if you 've all needed drivers
I used this it worked for me without any error:
sconnect = "Provider=MSDASQL.1;DSN=Excel Files;DBQ=" & myPath & ";HDR=Yes';"
Set con = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
con.Open sconnect
sSQLQry = "SELECT * FROM [" & tableName & "];"
Set rs = con.Execute(sSQLQry)
we had same issue where we were getting exception
Provider cannot be found. It may not be properly installed
with following machine configuration:-
machine:- window 10
oracle client installed:- oracle 12c
provider:- MSDAORA.Oracle (instead of OraOledb)
we have read number of blogs to resolve this where every post saying configuration issue between oracle client 12 to 11G version having 62 to 32bit inter dependency and lot more but it got resolved while changing the provider name from capital letter to small.
earlier provider name was:- MSDAORA.Oracle (Here Oracle "O" is in capital letter )
now provider name is:- MSDAORA.oracle (Here oracle "O" is in small letter )
please give a try, if that works for you :)
Check this out
EDIT: Warning, the link below goes straight to a download of 2007 Office System Driver: Data Connectivity Components.
http://www.microsoft.com/download/en/confirmation.aspx?id=23734
Installed it, read the instruction and everything worked as a charm.