Ask the Expert

Use LSX code to connect to SQL Server 2000

I'm running Domino 6.0.1 and SQL Server 2000 on my machine. I was able to connect to the SQL server using DECS, but DECS didn't give me the programmable power I required. I need to use LCX; but with LotusScript, I get the error message, "Instance member DATABASE does not exist," when I run this connection test code behind a button:
Dim connect As New 
LCConnection ("odbc2") 
 
' set the appropriate 
properties to connect to odbc2
' note the use of dynamic 
properties to do this
' all properties of a connection 
may be referenced
' by name
 connect.Database = "Northwind"
 connect.Userid = "user id here"
 connect.Password = "pwd here"
 
REM try the connect
 connect.Connect
 Print "Successfully connected
 to ODBC2."
End Sub

How can I successfully use LSX code to connect to SQL Server 2000?

Ah yes, the nuances of LC-LSX! The ODBC LCConnection Object uses the Server property to set the Data Source name. Try changing your code to: connect.Server = "Northwind."

It should connect.

I've been writing LC-LSX code since 1998, and I'm still not sure of all the correct properties for the various connectors. To see what the field names are for a particular connector, I look at the DECS or LEI connection form in Designer. Most often, the field names used on the Connection Document form have the same names as the properties used by the LC-LSX.

Do you have comments on this Ask the Expert question and response? Let us know.

This was first published in June 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: