cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting to SQL Anywhere DB without DSN

former_member329524
Active Participant
0 Kudos

Hello, all

I need to connect to multiple SQL Anywhere databases without creating DSN for all of them. The client is Win32 PB Classic.

THe application is connected to the main DB, which contains a table with connection parameters to the other DBs. THe connectino parameters include server, dbn and host. This is not enough to connect to SQL anywhere DB. I assume I either need a DSN name or the driver name.

Now, if creating the DSN is not possible, how can I locate the driver of the connecition the application is currently using. I could not find it in the connection_property function or the connection info or anywhere else.

Can anyone help?

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

reimer_pods
Participant
0 Kudos

It should be possible to connect to another database without having to create an ODBC data source. In your code, you'll have to create a new Transaction Object and populate it with the appropriate parameters.

IMHO you'll get better answers for PB related questions here:

http://scn.sap.com/community/powerbuilder

former_member329524
Active Participant
0 Kudos

Thank you, Reimer

It appears there is a SQL Anywhere solution to this problem after all.

The documentation was lacking clarity regarding what "driver=" is supposed be. I was assuming it is an actual DLL.

However, this simple code solves it:

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

select row_value

into :ls_app_info

from sa_split_list(connection_property('appInfo'), ';')

where row_value like 'version=%' ;

driver_name = "SQL Anywhere "  + left(mid(ls_app_info,  pos(ls_app_info, '=') + 1, len(ls_app_info)), 2)

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

The resulting value in driver_name is "SQL Anywhere X", which is exactly what was required.

Answers (1)

Answers (1)

chris_keating
Advisor
Advisor
0 Kudos

The value supplied to DRIVER= is dependent on platform. For example, it would typically be the shared library on UNIX and the DLL on Windows CE platforms (via PocketBuilder). However, on Windows desktops it is the Driver Name as defined in the ODBC Administrator configuration.