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

Dig Deeper on LotusScript

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close