LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to use SQLConfigDataSource to create a User DSN of mysql 5.1

hi, guys

 

I'm tried to use ODBC API SQLConfigDataSource function to programmatically create a User DSN of MySQL 5.1. I spent almost the whole week to searching at NI web and internet, and tried couple of ways. and now I had knew how to create a User DSN of MS Access by SQLConfigDataSource, but I still cannot create a User DSN of MySQL 5.1. Please refer the JPG file in below. I guess it shoud be is syntax problem but I don't know what is the correct syntax. I tried over five ways and all of fail.

 

Please help and advice the right way to solve this question. I will very appreciate so much for your kind.

thanks

Patch

0 Kudos
Message 1 of 24
(8,702 Views)
I guess the following post is quite similar to your situation:

How it's possible to add ODBC source to windows resources? 

But since it's an API of Microsoft, you can refer to MSDN, or see if the parameters are matched
corresponding to the content you see in the Call Library Function Node.

0 Kudos
Message 2 of 24
(8,667 Views)

hi, sonning

 

thank you very much for your reply and suggestion.

I had read the post and MSDN in internet couple times before. as I said I knew how to create a User DSN of MS Access, so those parameters should be matched.

I also knew somebody who use this API created successfully by use C or VB6.

So the syntax (refer to the attached jpg file) is refer from the guy, but still cannot works in LV. that's why I guess maybe is syntax problem.

 

thanks

Patch

0 Kudos
Message 3 of 24
(8,658 Views)

What kind of O/S are you using? Windows XP x32 or x64? Vista?

 

What dll are you calling? odbccp32.dll?

 

0 Kudos
Message 4 of 24
(8,652 Views)
according to SQLConfigDatasource settings, you should add EOS. maybe you can try using LF or CR, or using \n or \r instead of \0.
0 Kudos
Message 5 of 24
(8,648 Views)

You make quite a bit of a mess out of that string.

 

First the keywords are usually 3 letter abbreviations. Each parameter needs to be 0 terminated. and the whole parameter array needs to be double zero terminated.You may say parameter array???? Yes the string is an array of zero terminated strings and the last string element is an empty string, meaning its zero termination follows directly the previous one. Quotes if at all need to be put around the parameters, not the entire string array.

 

So taking this all lets look at your strings.

 

1) would be mostly right, except that quotes are totally wrong. You should do "DSN=aa\0Server=blabla\0..............\0\0" (quotes only to show the actual string but they should not be included in the string constant). You took that string probably literally from a C or Basic source example and there the quotes are necessary to tell the compiler that it is a string constant, but they are not part of the string constant itself. Of course you should enable backslash codes for that string.

2) "Data Source Name" is not likely a valid keyword.

3) Basically the same as 1)

4) parameters are not 0 terminated

5) errors from 2) and 4)

 

Rolf Kalbermatter

Message Edited by rolfk on 05-08-2009 01:01 PM
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 6 of 24
(8,640 Views)

thanks your reply

 

for bonbon

 

1. my OS is windows pro XP x32 SP3 and calling odbccp32.dll.

2. I tried \r or\n, but still not work.

 

for roflk

 

please open this file and check the number one string syntax whether like you said or not. if the string syntax the same you said and still not work.if not , could you please advice the correct string syntax.

 

thanks

patch

 

0 Kudos
Message 7 of 24
(8,607 Views)

patchchen wrote:

thanks your reply

 

for bonbon

 

1. my OS is windows pro XP x32 SP3 and calling odbccp32.dll.

2. I tried \r or\n, but still not work.

 

for roflk

 

please open this file and check the number one string syntax whether like you said or not. if the string syntax the same you said and still not work.if not , could you please advice the correct string syntax.

 

thanks

patch

 


I repeat: NO QUOTES!!!!!

 

They are only used in your C (and VB) examples to tell the compiler that it is a string constant but are not part of the string itself

 

Rolf Kalbermatter

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 8 of 24
(8,603 Views)

hi, rolfk

 

thanks your reply

 

you said no quotes, is that mean deleted " " ?

if it's right, after tried still not work. if not could you please advice...^^

 

please open this file and check those string syntax. number one to number three change the character form to capitalization and add some parameters. number four and number five change UID to ID. and still not work.

 

thanks

patch

0 Kudos
Message 9 of 24
(8,579 Views)

patchchen wrote:

hi, rolfk

 

thanks your reply

 

you said no quotes, is that mean deleted " " ?

if it's right, after tried still not work. if not could you please advice...^^

 

please open this file and check those string syntax. number one to number three change the character form to capitalization and add some parameters. number four and number five change UID to ID. and still not work.

 

thanks

patch


I really wonder! Your name is blue indicating that you are an NI employee. Am I supporting NI here now????

 

Rolf Kalbermatter

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 10 of 24
(8,562 Views)