Data source implementation?

I have done some work on a customised template which requires a lot of interaction between the Lotus Notes client and external database, SQL Server.

So far my implementation had been very simple, ie. establish the ODBC connection by creating the DNS from windows side, called the DNS name from Lotus via LotusScript and formula (LSXODBC, DBLOOKUP, etc). Everything works like a charm.

Now the hard part, since I found out that Domino Designer language does not support data source construction, only connectivity. So I would like to know is there anywhere I can manually set up my data source within Lotus environment without the need to create the DNS from windows environment.

The reason for this is because the template I created will be used by more than one client/user and it would be stupid to go out to all the users and set up the DNS for them.

I have go thru all the documentation and this forum and now I need some feedback.

Thanks in advance.

Subject: Data source implementation?

I don’t remember where I copied this code from but when I saw it, I figured it might come in handy some day, though I haven’t had occasion to use it myself. Maybe it will help you.

'Create ODBC Data Source via LotusScript:

Option Public

Option Explicit

Const ODBC_ADD_DSN = 1 ’ Add data source

Const ODBC_CONFIG_DSN = 2 ’ Configure (edit) data source

Const ODBC_REMOVE_DSN = 3 ’ Remove data source

Const ODBC_ADD_SYS_DSN = 4 ’ Add system data source

’ to customize this script, modify the attributes DSN = YourName, Server = YourServer, Database = YourDBPath

’ don’t forget to modify the final message box.

Dim dbDriver As String

Dim dbAttributes As String

Dim result As Integer

Declare Function SQLConfigDataSource Lib “ODBCCP32.DLL” (Byval hwndParent As Long, Byval fRequest As Long, Byval lpszDriver As String, Byval lpszAttributes As String) As Long

Sub Initialize

dbDriver = “Microsoft ODBC for Oracle”

dbAttributes = “DSN=Oasis” & Chr$(0) _

& “Description=Pull from Oasis” & Chr$(0) _

& “Server=xxxxxx” & Chr$(0)

result = SQLConfigDataSource(0, ODBC_ADD_DSN, dbDriver, dbAttributes)

If (False = result) Then

Msgbox “There was an error establishing the connection. You will have to do it manually.”, 16, “Failure”

Else

Msgbox “Data Source Name ““Oasis Connection”” configured.”

End If

End Sub

Sub Terminate

End Sub

'Add Data Source:

Option Public

Option Explicit

Const ODBC_ADD_DSN = 1 ’ Add data source

Const ODBC_CONFIG_DSN = 2 ’ Configure (edit) data source

Const ODBC_REMOVE_DSN = 3 ’ Remove data source

Const ODBC_ADD_SYS_DSN = 4 ’ Add system data source

’ to customize this script, modify the attributes DSN = YourName, Server = YourServer, Database = YourDBPath

’ don’t forget to modify the final message box.

Dim dbDriver As String

Dim dbAttributes As String

Dim result As Integer

Declare Function SQLConfigDataSource Lib “ODBCCP32.DLL” (Byval hwndParent As Long, Byval fRequest As Long, Byval lpszDriver As String, Byval lpszAttributes As String) As Long

Sub Initialize

dbDriver = “Microsoft ODBC for Oracle”

dbAttributes = “DSN=Oasis” & Chr$(0) _

& “Description=Pull from Oasis” & Chr$(0) _

& “Server=micses” & Chr$(0)

result = SQLConfigDataSource(0, ODBC_ADD_DSN, dbDriver, dbAttributes)

If (False = result) Then

Msgbox “There was an error establishing the connection. You will have to do it manually.”, 16, “Failure”

Else

Msgbox “Data Source Name ““Oasis Connection”” configured.”

End If

End Sub

Sub Terminate

End Sub

Hope that helps.

Subject: RE: Data source implementation?

thank for ur input. actually i did came across this code in the forum. unfortunately it was end of the day and i cant test it out. will do it soon. i find it weird in domino that doesnt allow own dns customisation/coding when it had come a long way since R5/R4.6. furthermore i was planning to write a javascript to create the dns and put it as shared resources.

one more thing concerning me now is the domino server is sitting on AIX while the sql server is located in window server 2003. i wonder they will ‘talk’?