Internet technologies and communication software



How can TB macro access database data?
Search  Users  Rules 
Close
Login:
Password:
Forgot your password?
Register
Login
 
Pages: 1
RSS
How can TB macro access database data?, as title
 
Can TB do it? Write a reply macro that extract incoming email data and use it to access database server(such as Mysql) to extract data information? Then the result return back to TB to complete the reply mail?

e.g. Passing eBay item number 8246789415 as parameter in order to connect database server to extract the date of the item shipped? e.g. It returns "10/21/2006" back to the reply mail content.

If it can't, any third party Plug-in program can do it? Thank you your help!
 
AFAIK TB can't access database servers, nor are there any capable plugins available that I know of.

However when you've got a command line driven tool that 's able to access your database and to place the output in a file, it's possible to make TB start it from a filter and place the output in a reply.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Thank you your valuable reply. I will try it! :oops:
 
Quote
cy cheung writes:
Can TB do it? Write a reply macro that extract incoming email data and use it to access database server(such as Mysql) to extract data information? Then the result return back to TB to complete the reply mail?


Perhaps SQL-plugin http://szumi.one.pl/thebat/SQL/ will help You.
 
Hello K_S & List

In the days of SPAM I want to write a program which connects to my local CRM DB and to a web form.

1. TB checks in DB by SQL if the e-mail is known.
2. If not send an e-mail with a link to the web form
3. Web form sends CSV or XML record
4. TB adds record to the DB


So http://szumi.one.pl/theba­t/SQL/ sounds very helpfull.

Any experiences, English manual? Thanks for some input.
 
First, You must to install ODBC driver for your database (for MySql http://dev.mysql.com/downloads/connector/odbc/3.51.html). Then You should use program %SystemRoot%\system32\odbcad32.exe (part of Microsoft Data Access Components) to quick and easy configuration of DNS to Your DB.

Then create a quick template (for example named 'ini') with a macro
Code
%SQLBuildConnectionString

and run this template (create a new message, type ini and press ctrl+space). Now choose a 'Microsoft OLE DB Provider for ODBC Services'. With other databases You must to choose other method (for MS Access it's 'Microsoft.Jet.OLEDB.4.0').

Now click on button 'Dalej' ('Next') and go to the 'Połączenie' ('Connection'):
1. 'Określ źrуdło danych' ('characterize data source')
- 'użyj nazwy źrуdła danych' - 'use the name of data source' (user DSN created in odbcad32.exe)
- 'użyj ciągu połączenia' – 'use the connection tring' - Button ‘Konstruuj’ (Construct): there You can choose or create 'File DSN' ('plikowe źrуdło danych') or 'Computer DSN', the best option is to use a odbcad32.exe to creating and then simply choosing what You want.

2. 'Wprowadź informacje o logowaniu do serwera' ('input information about login')
- 'Nazwa użytkownika' (username)
- 'Hasło' (password)
'Puste hasło' (empty password) 'Zezwalaj na zapisywanie hasła' (allow to save the password)

3. 'Wprowadź początkowy katalog do użycia' (input start directory for use).

Button 'Testuj połączenie' ('Test the connection'); use it :-)

'Zaawansowane' ('Advanced') - there are options:
'ustawienia sieciowe' ('network settings'): 'poziom personifikacji' ('personalize level') and 'poziom ochrony' ('protection level')

'Inne' ('Others'): 'Limit czasu połączenia' ('limit of a connection time'), 'uprawnienia dostępu' ('access rights')

'Wszystkie' ('All'): there You can manually edit all settings.

Click 'OK' and You will get a ‘connection string’: for example
Code
Provider=MSDASQL.1;Persist Security Info=False;Data Source=The Bat test

Copy this string somewhere, will be used in the next templates.

Now You should have access to Your database. You have two macros:
Code
%SQLQuery("ConnectionString", "SQL_Query")

returns dataset in lines, with data divided by commas
Code
%SQLCommand("SQL_Connection_String", "SQL_Command")

returns nothing.

for example
Code
%_connstr="Provider=MSDASQL.1;Persist Security Info=False;Data Source=The Bat test"%-
%_query="SELECT * FROM mytable"%-
%SQLQuery(%_connstr, %_query)%-


If You have the connection and tested some templates (SELECT email FROM users WHERE email=’test@mail.com’ etc) You could start to create a machine for Your four points
1. TB checks in DB by SQL if the e-mail is known.
%SQLQuery. Template in a filter? Template executed by script on Your server?
2. If not send an e-mail with a link to the web form
Template could create mail for sending (/MAIL)
3. Web form sends CSV or XML record
4. TB adds record to the DB
Very complicated filter with giant template and macro %SQLCommand - hard, but possible.

Sorry for my ungrammatic English
 
Hello,
http://szumi.one.pl/thebat/SQL/ is not Online anymore..
http://nobat.ru too. From where i can find SQLPlugin.tbp :(

please help ..
 
Quote
luci excell wrote:
Hello,
http://szumi.one.pl/thebat/SQL/ is not Online anymore..
http://nobat.ru too. From where i can find SQLPlugin.tbp

please help ..


I've found this link:
http://www.findthatfile.com/search-338454-hRAR/winrar-winzip-download-sqlplugin01-rar.htm
Pages: 1
Users browsing this topic (1 guests)