Solved

DNS-less connection to Sybase

Posted on 1998-11-17
7
600 Views
Last Modified: 2013-12-25
I'm trying to make a DSN-less RDO connection to a Sybase SQL server. I can make the connection fine with a user DSN, but I want to make the connection without the DSN. Here's what I'm using...

strConnection = "UID=user;PWD=password;" _
    & "DATABASE=dbname;" _
    & "SERVER=SYBASE;" _
    & "DRIVER={Sybase System 11};DSN='';"
Set rdoCon = rdoEnv.OpenConnection(dsName:="", _
    prompt:=rdDriverNoPrompt, _
    Connect:=strConnection)

If I set the prompt to rdDriverPrompt, I get a dialog box that allows me to enter 'SYBASE' as the server, and the connection is made - my query won't run (not sure why - says no cursor is open), but it does connect. However, running the connection above with rdDriverNoPrompt(which is how it should run) results in an error - [Intersolv][ODBC SQL Server Driver] Invalid attribute in connection string: SERVER. - which sounds like a syntax error, but that format is straight from the help file. Anyone have any ideas? Thanks.
0
Comment
Question by:Joe33
7 Comments
 

Author Comment

by:Joe33
Comment Utility
Edited text of question
0
 
LVL 3

Expert Comment

by:vmano
Comment Utility
is your server/computer name SYBASE? if not, try this:
change the parameter SERVER to the server/computer name where the database is.you can find the computer name in controlpanel->network->identification tab. and also, you don't have to specify the DSN parameter.

let me know if this helps
vmano
0
 

Author Comment

by:Joe33
Comment Utility
The server is named 'SYBASE'...if I run the connect string with an rdDriverPrompt, I can enter the server name (SYBASE) and it will make a connection. For some reason, it won't connect when it's an rdDriverNoPrompt, I get the 'invalid attribute: SERVER' when it runs. Thanks again.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 3

Expert Comment

by:vmano
Comment Utility
try this:
Dim cn As New rdoConnection
Dim qd As New rdoQuery

cn.Connect = "uid=USER;pwd=PASSWORD;server=SYBASE;" _
    & "driver={Sybase System 11};database=DBNAME;DSN='';"
cn.cursordriver = rdUseOdbc
cn.EstablishConnection rdDriverNoprompt
debug.print cn.Connect

Set qd.ActiveConnection = cn

let me know if this helps
vmano
0
 

Expert Comment

by:Coates
Comment Utility
You can specify the Server Name etc while setting up the ODBC under control panel. This means that you only have to reference the DSN name in your code and the predefined ODBC will do the rest:
e.g:
Dim cn as rdoConnection;
cn.Connect = "DSN=dsnname;UID=uid;PWD=password";
cn.CursorDriver = rdUseODBC
cn.EstablishConnection rdDriverNoPrompt

This should connect using the server and driver details specified in control panel and then connect without showing a dialog box, which is what i think you want.
Hope this works,
0
 

Author Comment

by:Joe33
Comment Utility
I've gotten it to work with a DSN, I'm trying to avoid setting up a DSN on every client machine by using a DSN-less connection.

Thanks
0
 
LVL 1

Accepted Solution

by:
pmteixeira earned 200 total points
Comment Utility
Hi Joe,

if you still have this problem, why don't you set the prompt to rdDriverPrompt and normally enter your code, adding this line to it:

       MsgBox rdoCon.Connect

This way you can see the connect string that was used (and this one must work)! Like you, I believe that your error is a syntax error due to the driver you're using!
But after having a correct ConnectString you may paste it into your code and use rdDriverNoPrompt.

Hope this helps,

PMT
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now