10-31-2014 09:36 AM
Hello,
can annybody name some good example of how to access databases in Diadem? I read a lot in the manuals, contacted support but nothing really worked out for me.
I currently use mySQL which is running locally on my machine. I got some ODBC System DSN set up which were tested running.
I tried using the SQL_Connect command. It reports that it couldn't find the database. The support said it could be a syntax error (?????). Is this command only usable for .mdb files?
I read about the CreateObject("ADODB.Connection") but I do not know how this should work in total.
Has anybody some hints, examples or tutorials of how to connect to a mySQL database in which way ever.
BR
Chris
10-31-2014 10:21 AM
Chris
The following script should work from mysql. You may not have the Mysql ODBC 5.1 driver installed on your machine. Should be able to google and find that.
The other settings should be able to be found from the ODBC DSN setup values, or the MySql settings.
Of course you will need to change the select string to fit your tables.
Paul
ps The code was obtained from
http://stackoverflow.com/questions/1366516/connect-to-mysql-5-0-database-using-pure-vbscript
dim cn, rs
i = 0
set cn = CreateObject("ADODB.Connection")
set rs = CreateObject("ADODB.Recordset")
connectionString = "Driver={MySQL ODBC 5.1 Driver};Server=localhost;Data Source=dsn_hb; Database=TP;User=root; Password=venu;"
cn.Open connectionString
rs.open "select * from test.Login", cn, 3
rs.MoveFirst
'msgbox rs(0)'
while not rs.eof
msgbox rs.Fields(0)
rs.MoveNext
wend
cn.close
MsgBox "End of program"
11-03-2014 02:21 AM
You should defenetively use ADO instead of the SQL_... commands
Option Explicit call ADOConStrGet() MsgBox AdoConString
shows the MS connection dialog. It is possible to check if it can be connexted inside the dialog.
The ADOConString contains the string that is equal to the one configured in the dialog.
The string can be used to connect to ADO. DIAdem contains an "ADO example".
Important is the
ArrayToChannels
method because it can be used to effectively transform a select result into DIAdem channels.
11-05-2014 09:04 AM
Hi Chris,
does the question still exist or did the replies from Pesmith8 and AndreasK answer it?
Regards,
Julia