Skip to Content
0
Former Member
Jun 13, 2016 at 06:53 AM

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

412 Views

Hi All,

With PB12.5 here.

I would like to check, where to get the directory of ini file used for database connection.

Actually my problem is, my program is set to get db connection using .ini file and it seems working fine at my local.

After I create a exe file and put into client's server, it shows error below:

//---------

Cannot Connect to Database

SQLSTATE - IM002

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

//----------

Below is the content of ini file and fyi, I have another program which is working fine in the same server and exactly the same .ini file setup as below, but don't know why it hits error: cannot connect to Database when comes to this new program.

[DataBase]

DBMS=ODBC

Database=

UserId=

DatabasePassword =

LogId=

LogPassword=

ServerName=

DbParm=ConnectString='DSN=abc;UID=aaa;PWD=password'

Below are the ini file setup in programming code, for your reference:

/* Variable determines where the source of

the connection information comes from */

string is_connectfrom = "1"

CONSTANT string IS_USE_INIFILE = "1"

CONSTANT string IS_USE_REGISTRY = "2"

CONSTANT string IS_USE_SCRIPT = "3"

////////////////////////////////////////

//*--------------------------------------------------------*/

//* Connection Information is obtained from either:

//* - An INI File

//* - The Windows Registry

//* - Script

//*

//* The source of connection information can be changed by

//* altering the value of the 'is_connectfrom' variable.

//*--------------------------------------------------------*/

string ls_dbms, ls_database, ls_userid, ls_dbpass, ls_logid, ls_logpass

string ls_server, ls_dbparm, ls_lock, ls_autocommit

If of_GetConnectionInfo ( ls_dbms, ls_database, ls_userid, ls_dbpass, ls_logid, ls_logpass, ls_server, ls_dbparm, ls_lock, ls_autocommit ) = 1 Then

SQLCA.DBMS = ls_dbms

SQLCA.Database = ls_database

SQLCA.UserID = ls_userid

SQLCA.DBPass = ls_dbpass

SQLCA.LogID = ls_logid

SQLCA.LogPass = ls_logpass

SQLCA.ServerName = ls_server

SQLCA.DBParm = ls_dbparm

SQLCA.Lock = ls_lock

Choose Case Lower ( ls_autocommit )

Case "1", "true", "on", "yes"

SQLCA.AutoCommit = True

Case "0", "false", "off", "no"

SQLCA.AutoCommit = False

Case Else

SQLCA.AutoCommit = False

End Choose

End If

///////////////////////////

Kindly advise for provide me some direction for further checking.

Thank you in advance.

BR,

Yow