Create, Delete Or Edit An Odbc Dsn From Lotusscript (Or Vb)

With the release of NotesSQL 2.06 you run create a silent installation when you
distribute your Notes apps. The problem has been creating a DSN so users can
access the database via ODBc (for Reporting).
This script will create, delete or edit the DSN for you, and it works in VB
too.
Option Explicit

Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL" (ByVal hwndParent As
Long, ByVal fRequest As Long, ByVal lpszDriver As String, ByVal lpszAttributes
As String) As Long


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

' 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

dbDriver = "Lotus NotesSQL Driver (*.nsf)"
dbAttributes = "DSN=Reports" & Chr$(0) _
& "Description=Reports" & Chr$(0) _
& "Server=Server1" & Chr$(0) _
& "Database=somedir\test.nsf" & Chr$(0) _
& "KeepTmpIdx=0" & Chr(0) _
& "MapSpecialChars=Y" & Chr(0) _
& "MaxLongVarcharLen=512" & Chr(0) _
& "MaxRels=20" & Chr(0) _
& "MaxStmtLen=8192" & Chr(0) _
& "MaxSubquery=20" & Chr(0) _
& "MaxVarcharLen=254" & Chr(0) _
& "ShowImplicitFlds=0" & Chr(0) _
& "ThreadTimeout=60" & Chr(0) & 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 ""ISNOTESSQL"" configured."
End If


End Sub
This was first published in November 2000

Dig deeper on LotusScript

0 comments

Oldest 

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:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close