Create DSN's for Sybase

Pat Hartman

Super Moderator
Staff member
Local time
Today, 00:57
Joined
Feb 19, 2002
Messages
47,145
Has anyone ever used the procedure described in "Q159691 - Procedure to Create Data Sources and Relink ODBC Tables" to successfully create a DSN for a Sybase System 11 database?

I modified the DBEngine.RegisterDatabase statement to use a variable rather than a literal to specify the Driver I wanted to use and added that column to the table used by the procedure. The code works properly for my DB2 tables but fails with an error 3151 when trying to link or refresh the link for a Sybase table.

Using the Control Panel I can look at the DSN's created by the procedure and they don't show a value in the Server Name field even though one is provided in the code. This doesn't seem to bother the DB2 DSN, I can use it either in code or manually to link tables. If I manually change the Sybase DSN so that it includes the Server name it works fine. I'm flying blind here because I don't have any documentation for the Sybase System 11 ODBC driver but I took a shot and added "ServerName=blahblah" to the other parameters in the RegisterDatabase Method. That managed to get the Server name to actually show in the Server name field but the link via code still failed with error 3151. However, trying to use this DSN manually to link results in a very strange message - Intersolve(ODBC SQL Server driver) Number contains an invalid character: 0 - Default(#2702). For some reason this DSN now thinks it is for an SQL Server databse rather than Sybase System 11. We're using the Sybase driver not an Intersolve driver. Anyway, if I edit the DSN through the Control panel interface and just retype the server name, it works just fine.
 
Hi Pat,

I think this is an old posting, however I ran into the same situation recently.

Did you give Driver = Sybase in the connect string?

Actually When I designed the access database I relinked to the databse thru ODBC.

I am doing just this to refresh the link during the application startup.
Dim dbCurrent As DAO.Database
Dim tdCurrent As DAO.TableDef

Set dbCurrent = CurrentDb

For Each tdCurrent In dbCurrent.TableDefs
If (tdCurrent.Attributes And dbAttachedODBC) = dbAttachedODBC Then
tdCurrent.Connect = tdCurrent.Connect & ";UID=sa;PWD="
tdCurrent.RefreshLink
End If
Next

dbCurrent.TableDefs.Refresh

Set dbCurrent = Nothing

While deploying the application I just install the DSN that I had used, thats about it, everything seems to be working quite fine with no manual work related to ODBC.
 

Users who are viewing this thread

Back
Top Bottom