6

Install An ODBC connection from cmd line

Hi, i want to install an odbc connection threw the cmd line, in this cmd below i can open
only a name and driver of the database i want to use. i need to add also a ip,user,password,description.

enter image description here

odbcconf configsysdsn "MySQL ODBC 5.2w Driver" "DSN=test1|SERVER=(local)"

Ofir Attia
  • 1,237
  • 4
  • 21
  • 39

2 Answers2

7

ok, figured out!
odbcconf configsysdsn "MySQL ODBC 5.2w Driver" "DSN=test;SERVER=127.0.0.1;PORT=3306;DATABASE=mdb;UID=root "

Ofir Attia
  • 1,237
  • 4
  • 21
  • 39
  • 2
    There hello as you post the entire command line. I made mine with following criteria : Odbcconf.exe / a { ConfigDSN " MySQL ODBC 5.1 Driver" "DSN = desired name ; Description = My connection ; SERVER = xxx ; Trusted_Connection = No ; Database = xxx ; Port = 3306 ; UID = root ; PWD = xxx "} but is returning error. "They're missing atribultos " – Fabrício Simone Alana Mendes Jul 02 '15 at 12:36
  • On my computer (Windows 10 Pro 2004), delimiters in command-line arguments must use a vertical bar instead of a semicolon. – wenhx Feb 02 '21 at 01:12
6

According to this article on Microsoft.com:

ODBCCONF.exe will be removed in a future version of Windows Data Access Components. Avoid using this feature, and plan to modify applications that currently use this feature. You can use PowerShell commands to manage drivers and data sources. For more information about these PowerShell commands, see Windows Data Access Components cmdlets.

The Power Shell equivalent to your command would be:

Add-OdbcDsn -Name "test" -DriverName "MySQL ODBC 5.2w Driver" -Platform "32-bit" -DsnType "System" -SetPropertyValue @("SERVER=127.0.0.1", "PORT=3306", "DATABASE=mdb")
JonathanDavidArndt
  • 2,518
  • 13
  • 37
  • 49