#138747 - 2005-05-04 03:57 AM
Re: MySQLODBC() usage questions
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Quote:
no no no. What I was using to install is the MySQL ODBC msi. It's not mysql itself, just the ODBC driver. It's linked earlier in this thread.
So... Isn't the last reply that I gave cover that?
Kent
|
Top
|
|
|
|
#138749 - 2005-05-04 05:06 PM
Re: MySQLODBC() usage questions
|
thepip3r
Hey THIS is FUN
Registered: 2005-03-02
Posts: 350
|
what does the "/i" do for msiexec.exe in your new installation?? And the reason I was saying that it still wasn't working for me is because I did this:
Code:
;COPY MYSQL ODBC DRIVERS TO TARGET SYSTEM SO THEY CAN WRITE TO THE DATABASE DIM $sourcepath,$connkey,$regkey,$x $sourcepath= "\\gjlk2w2ws101\SoftwarePushes\sms\" $connkey = "HKCU\Software\ODBC\ODBC.INI\" $driver = "%windir%\System32\myodbc3.dll" $regkey = "HKLM\Software\ODBC\ODBCINST.INI\MySQL ODBC 3.51 Driver" IF @ERROR <> 0 "@ERROR: @SERROR" ENDIF Sleep 2
IF NOT Exist("%windir%\system32\myodbc3.dll") COPY $sourcepath+"myodbc3.dll" "%windir%\system32\myodbc3.dll" ENDIF
IF NOT Exist("%windir%\help\my3dsn.hlp") COPY $sourcepath+"my3dsn.hlp" "%windir%\help\my3dsn.hlp" ENDIF
IF NOT Exist("%windir%\system32\myodbc3s.dll") COPY $sourcepath+"myodbc3s.dll" "%windir%\system32\myodbc3s.dll" ENDIF
IF ReadValue("HKLM\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers","MySQL ODBC 3.51 Driver")<>"Installed" $x=WriteValue("HKLM\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers","MySQL ODBC 3.51 Driver","Installed","REG_SZ") ENDIF
IF ReadValue($regkey,"UsageCount")<>12 $x=WriteValue($regkey,"UsageCount",12,"REG_DWORD") ENDIF
IF ReadValue($regkey,"Driver")<>"%windir%\System32\myodbc3.dll" $x=WriteValue($regkey,"Driver","%windir%\System32\myodbc3.dll","REG_SZ") ENDIF
IF ReadValue($regkey,"Setup")<>"%windir%\System32\myodbc3.dll" $x=WriteValue($regkey,"Setup","%windir%\System32\myodbc3.dll","REG_SZ") ENDIF
IF ReadValue($regkey,"APILevel")<>2 $x=WriteValue($regkey,"APILevel",2,"REG_SZ") ENDIF
IF ReadValue($regkey,"ConnectFunctions")<>"YYN" $x=WriteValue($regkey,"ConnectFunctions","YYN","REG_SZ") ENDIF
IF ReadValue($regkey,"DriverODBCVer")<>"03.51" $x=WriteValue($regkey,"DriverODBCVer","03.51","REG_SZ") ENDIF
IF ReadValue($regkey,"FileUsage")<>0 $x=WriteValue($regkey,"FileUsage",0,"REG_SZ") ENDIF
IF ReadValue($regkey,"FileExtns")<>"*.txt" $x=WriteValue($regkey,"FileExtns","*.txt","REG_SZ") ENDIF
IF ReadValue($regkey,"SQLLevel")<>1 $x=WriteValue($regkey,"SQLLevel",1,"REG_SZ") ENDIF
IF ReadValue($regkey,"CPTimeout")<>60 $x=WriteValue($regkey,"CPTimeout",60,"REG_SZ") ENDIF
IF ReadValue($regkey,"DNSHelpFile")<>"%windir%\help\my3dsn.hlp" $x=WriteValue($regkey,"DNSHelpFile","%windir%\help\my3dsn.hlp","REG_SZ") ENDIF
IF ReadValue("HKLM\Software\ODBC\ODBCINST.INI\ODBC Core","UsageCount")<>1 $x=WriteValue("HKLM\Software\ODBC\ODBCINST.INI\ODBC Core","UsageCount",1,"REG_DWORD") ENDIF
Sleep 2
...I ran this code AFTER I uninstalled the msi installation. And after I uninstalled it, it didn't work AND after I ran this file my script didn't work and it's copying the files over correctly and creating the appropriate registry keys. That's why I was saying that I was going to look at the odbc.msi installation with a snapshot viewer to see if I could find what I was missing that was causing this script not to work correctly.
|
Top
|
|
|
|
#138750 - 2005-05-04 06:18 PM
Re: MySQLODBC() usage questions
|
thepip3r
Hey THIS is FUN
Registered: 2005-03-02
Posts: 350
|
WOOOHOO!! I think I figured out how to push it out through SMS with the MSI Package!
For systems with Windows XP SP1(or systems with Windows Installer version 2) or <, the string should be:
package.msi /qn
For systems >= Windows XP SP2 or Windows Installer version 3, the string should be:
package.msi /quiet
Thanx so much for all of the help with this one all. Kyder, I appreciate your efforts. It steered me in the right direction.
Edited by thepip3r (2005-05-04 06:20 PM)
|
Top
|
|
|
|
#138751 - 2005-05-04 06:22 PM
Re: MySQLODBC() usage questions
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
You should read the Microsoft Knowledgebase article - Command-Line Switches for the Microsoft Windows Installer Tool
The /i is:
Quote:
/i Package|ProductCode Installs or configures a product.
Kent
|
Top
|
|
|
|
#138752 - 2005-05-04 06:25 PM
Re: MySQLODBC() usage questions
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Quote:
For systems with Windows XP SP1(or systems with Windows Installer version 2) or <, the string should be:
package.msi /qn
For systems >= Windows XP SP2 or Windows Installer version 3, the string should be:
package.msi /quiet
And... The difference is?? Code:
IF 0=Exist('%windir%\system32\myodbc3d.dll') RUN 'MsiExec.exe /i @ldrive+"Programs\MySql.msi" /qn' ENDIF
You should not need the /quiet switch per - Command-Line Switches for the Microsoft Windows Installer Tool.
Can you post your finalized code on this?
HTH,
Kent
|
Top
|
|
|
|
#138754 - 2005-05-04 09:35 PM
Re: MySQLODBC() usage questions
|
thepip3r
Hey THIS is FUN
Registered: 2005-03-02
Posts: 350
|
Yes NTDOC, that's exactly the problem! Windows SP1 and < has windows installer version 2.0. It has different command line switches than windows installer version 3.0 which is the version that is installed with XP SP2.
Here is the code I'm using to push out through SMS:
Code:
$SO = SetOption('NoVarsInStrings','On')
$sp = @CSD $os = @PRODUCTTYPE $path = "\\gjlk2w2ws101\SoftwarePushes\sms\" $packageName = "MyODBC-3.51.msi"
if $os = "Windows XP Professional" if $sp = "Service Pack 1" SHELL '%COMSPEC% /e:1024 /c '+$path+$packageName+' /qn' endif if $sp = "Service Pack 2" SHELL '%COMSPEC% /e:1024 /c '+$path+$packageName+' /quiet' endif else SHELL '%COMSPEC% /e:1024 /c '+$path+$packageName+' /qn' endif
For those of you who had a differing opinion of me when I was asking about using variables in strings, you'll be proud to note that I wrote this script with them off. On the other hand, I'm not using explicit so this may cause another roasting but we'll see. =D
Edited by thepip3r (2005-05-04 09:38 PM)
|
Top
|
|
|
|
#138755 - 2005-05-05 05:02 PM
Re: MySQLODBC() usage questions
|
thepip3r
Hey THIS is FUN
Registered: 2005-03-02
Posts: 350
|
Final Code I pushed out through SMS and it reported 3607 Received - 3606 Success. I just have to troubleshoot one! =D
Code:
DIM $SO,$programArray,$program DIM $sp,$os,$path,$packageName
$SO = SetOption('NoVarsInStrings','On')
;########## CHECK TO SEE IF MyODBC DRIVERS ARE ALREADY INSTALLED ########## $programArray = GetUninstallInfo()
For Each $program In $programArray If $program = "MyODBC" quit Endif Next
;########## INSTALL MYSQL BASED OFF OF WINDOWS INSTALLER VERSION ########## $sp = @CSD $os = @PRODUCTTYPE $path = "\\gjlk2w2ws101\SoftwarePushes\sms\" $packageName = "MyODBC-3.51.msi"
if $os = "Windows XP Professional" if $sp = "Service Pack 1" SHELL '%COMSPEC% /e:1024 /c '+$path+$packageName+' /qn' endif if $sp = "Service Pack 2" SHELL '%COMSPEC% /e:1024 /c '+$path+$packageName+' /quiet' endif else SHELL '%COMSPEC% /e:1024 /c '+$path+$packageName+' /qn' endif
;######### START UDFs ########### Function GetUninstallInfo() Dim $Index, $Key, $RC, $Value, $RootKey Dim $progs[0] $Index = 0
$RootKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
$Key = EnumKey($RootKey, $Index) While @Error = 0 ReDim PRESERVE $progs[$Index] $RC = EnumValue($RootKey + $Key, 1) If @Error = 0 $Value = ReadValue($RootKey + $Key, "DisplayName") If $Value = "" $Value = ReadValue($RootKey + $Key, "QuietDisplayName") If $Value = "" $Value = $Key EndIf EndIf Else $Value = $Key EndIf ;? $Value $progs[$Index] = $Value $Index = $Index + 1 $Key = EnumKey($RootKey, $Index) Loop $GetUninstallInfo = $progs EndFunction
Ok, Ok, I broke down and rewrote it for explicit. =D
Edited by thepip3r (2005-05-05 07:02 PM)
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 259 anonymous users online.
|
|
|