PDA

View Full Version : Create ODBC Connection


KevinD
09-21-2008, 09:28 AM
I have created an installer which installs a scheduling program for a particular task. This is done using code in the Post Install actions.

One of the other programs installed uses an ODBC connection and I am trying to get the installer to create this but without success. This code is also in the Post Install actions.

ODBC.ConfigDataSource("{MySQL ODBC 5.1 Driver}", "DSN=FSG Callbacks\\0Database=Calbacks\\0UID=kevin\\0DESCRI PTION=FSG Callbacks\\0Driver={MySQL ODBC 5.1 Driver}\\0", ODBC_ADD_SYS_DSN);

Can anyone tell me what is wrong with the above line? I am running th installer on Windows Server 2003. The default code for the Attributes shows a DriverID pair. Where can I find this value?

I have tried with both MySQL 3.51and 5.0.

Thanks in advance.

Kevin

Ulrich
09-21-2008, 10:50 PM
Here is an example for creating a system DSN called "IR_Forum" for MySQL ODBC driver 3.51:


ODBC.ConfigDataSource("MySQL ODBC 3.51 Driver", "DSN=IR_Forum;Description=Test;Server=localhost;Use r=root;Password=mysecret;Database=centralserver", ODBC_ADD_SYS_DSN);


This creates an entry like demonstrated in the screenshots below.

Ulrich

KevinD
09-22-2008, 02:34 AM
Ulrich,

I had been looking in the Help File which set the elements should be separated by \\0 which is why I used that.

when I get back to the machine I will try it semi-colons and see if that works.

Thanks

Kevin

KevinD
09-23-2008, 11:21 AM
Ulrch,

That worked. Thanks.

Kevin

Mibe
01-14-2009, 08:16 AM
ODBC.ConfigDataSource("MySQL ODBC 5.1 Driver", "DSN=DbName;Description=SomeDesc;Server=localhost;U ser=Me;Password=pasw;Database=somedb", ODBC_ADD_SYS_DSN);
This doesn't work on my pc.

I'm using version 7

Also did try to replace \\0, but the results is still nothing.

Any suggestions?

Tx Mike

Ulrich
01-14-2009, 11:32 AM
Probably it will help if you enable a detailed install log and check there what is happening.

Ulrich

Mibe
01-16-2009, 08:51 AM
Hellow,

Where do i set the log to detailed? It is now set to Extended errors

Result:

[01/16/2009 15:27:37] Error Script: On Post Install, [2]: ODBC.ConfigDataSource("MySQL ODBC 5.1 Driver", "DSN=DbName\\0Description=SomeDesc\\0Server=localho st\\0User=Me\\0Password=Pasw\\0Database=somedb", ODBC_ADD_SYS_DSN); (3506)

Ulrich
01-16-2009, 09:33 AM
Hello,

this is exactly what I needed to know. Have you noticed the error code?
Error 3506 means: "The Driver argument was invalid, it could not be found in the registry."

In other words, the driver you try to use seems not to be installed or available, or it does have another name in the registry, somehow.

Have you tried to use the version 3.51 of the MySQL driver? It could be that there is something hosed with the newer driver. I have used the older driver a few times without trouble.

Ulrich

Mibe
01-16-2009, 10:09 AM
OMG, That's it :) 3.51 has no problems at all!


Many tx and enjoy the weekend!

Mibe
01-16-2009, 10:59 AM
OMG, That's it :) 3.51 has no problems at all!


Many tx and enjoy the weekend!

And now I can also created within VB6.

I think I see the reason. (read think :p)
MySQL 3.51 Driver file is in de system32 dir. The MySQL 5.1 is in a folder under Program Files. That's why ODBC can't reconize the driver.

Bye