Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

referencing dll not in system32

Posted on 2009-07-09
3
Medium Priority
?
320 Views
Last Modified: 2012-05-07
I want to refrencing the dll not from system32 but from c:\mydir

this is my real code and the dll is myodbc3.dll:

 

Option Explicit
Dim CONN As ADODB.Connection
Dim RS As ADODB.Recordset
Dim USERNAME As String
Dim PASSWD As String
Dim SERVERIP As String
Dim DB As String
Public Function connectMysql(USERNAME As String, PASSWD As String, SERVERIP As String, DB As String, CONN As ADODB.Connection, RS As ADODB.Recordset)
 
Set CONN = New ADODB.Connection
Set RS = New ADODB.Recordset
PASSWD = "aaaa"
 
CONN.CursorLocation = adUseClient
 
CONN.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=" & SERVERIP & ";UID=" & USERNAME & ";PWD=" & PASSWD & ";DATABASE=" & DB & ";" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 163841
CONN.Open
 
End Function
Sub uno()
Call connectMysql("root", "", "xxxxxxxxxx", "TEST", CONN, RS)
End Sub

Open in new window

0
Comment
Question by:luca2009
  • 2
3 Comments
 
LVL 16

Expert Comment

by:HooKooDooKu
ID: 24813439
Either the dll needs to be an Active X DLL...
  if so, then when the dll is registered, the location of the DLL will be recorded in the registry...

Or the dll needs to be located in a folder that is included in the Environment Variables/System Variable "PATH" (or update your "PATH" system environment variable to include "C:\MyDir".

Under XP, you will find PATH in ...
Settings, Control Panel, System Properties, Advanced Tab, Environment Variables Button.  Path is specifically in the values in the lower section.  Once modified (by adding ";C:\MyDir" to the end of the existing Path") you might have to restart your computer.
0
 

Author Comment

by:luca2009
ID: 24813776
Complicated for me....
In other case the original my prob is:

When i run the code on pc where is intalled "The Connector 3.5.1-MySql" all work fine an i connect the project with no prob...
The prob is when i run a code on pc where not is installed the "The Connector 3.5.1-MySql" have error not found provider ecc....

I think because the dll not is installed on pc of other user.

I dont want to install for each pc in my lan (45 pc)  "The Connector 3.5.1-MySql", sure!

If have other solution to connect mysql with the standard configuration of pc are welcome!
0
 
LVL 16

Accepted Solution

by:
HooKooDooKu earned 1500 total points
ID: 24815384
If you are attempting to run an executable program from a computer, you are going to have to find a way to install all of the dependency DLLs.  Period.  The only ways I know to avoid installing "stuff" on 45 pc is to have an ActiveX EXE or browser based application where basically the OS does the updates for you.  But if the project wasn't built from the ground up with that in mind, you are stuck installing the EXE and all dependency DLLs.

If you have no control over the dependancy DLLs, then you are forced to do one of two things (based on the type of DLL).  If it's an ActiveX DLL (for example, a DLL built from VB6), then you have to place the DLL just about anywhere (possibly even network drives) and use Regsrv32.exe to register the DLL (doing so will basically update the registry of the computer to say where the DLL lives).  If the DLL is NOT an ActiveX DLL, then you have to have it located somewhere that the application can find it.  That can be the "working folder" of the application (aka Startup Folder).  If not, the the DLL has to be located in one of the folders listed in the "PATH" environment variable.  System32 will be included in the "PATH" of basically every windows machine.  But you have the control (manually, as well as with instilation applications) to add what ever folder that you want to that "PATH".

The only other choise I've ever heard of is developer applications that can take an EXE and dependancy DLLs and wrap them together in to one giant EXE.  But that's 3rd party apps you have to get into.

I guess bottom line, if your application is going to use "MySQL ODBC 3.51 Driver", you've GOT TO install that driver (and any dependancy DLLs) on every machine you want to be able to run your application on.  You will have to do it manually, write an application/script yourself, or look into third-party tools that help you build instilation applications... or rebuild the application from the ground up to be browser based.  
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question