Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a DSN for SQL server programmatically using win32::ODBC

Status
Not open for further replies.

kadaru

Programmer
Dec 30, 2002
4
US
HI
I want to create a DSN programmatically ( not using GUI). The database that i want to create a DSN for is MS SQL server. I know that i need to use the ConfigDSN function but it takes a set of options where i need to set the differetn options like server name , port number, user name , password etc. I know how to set all other parameters in that but i dont know how to set the port number and since i am not setting the port number it is taking the default port and i am not able to connect. Can some body help me with a working code??????

Win32::ODBC::ConfigDSN(ODBC_ADD_SYS_DSN,"SQL Server","DSN=$dsn","SERVER=$sqlServer","ADDRESS=$address","Database=$database","NETWORK=DBMSSOCN","TRUSTED_CONNECTION=NO") or die "couldn't create $dsn because ", Win32::ODBC::Error(), "\n";

this is a working code but it does not set the port number so it does not create a correct DSN. please help me how to do it?

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top