Run an SQL INSERT statement against an Oracle database

Get help with using AutoHotkey and its commands and hotkeys
johnny256ahk
Posts: 24
Joined: 04 Dec 2014, 07:47

Run an SQL INSERT statement against an Oracle database

26 Feb 2015, 12:21

I've seen a couple of libs supporting SQL but they only mention explicitly Access, SQLLite, that I can see. It seem I should be able to connect to any DB but could anyone give a slightly more concrete example how that might be done for Oracle? Can I just put a connection string in my script for instance?
User avatar
Gio
Posts: 865
Joined: 30 Sep 2013, 10:54
Location: Brazil

Re: Run an SQL INSERT statement against an Oracle database

26 Feb 2015, 19:15

Hello johnny256ahk.

Welcome to the AutoHotkey community forums :angel:

I currently use ADOSQL() by VxE to manage a SQL Server DataBase from an AHK Script. It allows me to pass in all kinds of statements.

Usage is pretty simple, and all you need is a valid connection string, and the SQL query to be processed. A 2D table object is returned by the function, and you can access the values of the cells with:

Code: Select all

object[row, column]

Example:

Code: Select all

ConnectString := "" ; Adjust your connection string here.
Query := "SELECT * FROM Table" ; Adjust table name here.
RESULT := ADOSQL(ConnectString, query)
msgbox % RESULT[2, 1] ; First row contains the column names, so use the second.
Best wishes :thumbup:
User avatar
tank
Posts: 2825
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Irving TX
Contact:

Re: Run an SQL INSERT statement against an Oracle database

27 Feb 2015, 21:34

never bothered with a library
i always just use adodb.connection and adodb.recordset against a configured ODBC connection.
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
Check Out WebWriter
Thanks Tank :thumbup:
johnny256ahk
Posts: 24
Joined: 04 Dec 2014, 07:47

Re: Run an SQL INSERT statement against an Oracle database

02 Mar 2015, 04:51

tank wrote:never bothered with a library
i always just use adodb.connection and adodb.recordset against a configured ODBC connection.
Do you mean an externally configured ODBC connection, or done through AHK? I have vague memories of setting up DSNs but am not sure if this is what you're referring to.
johnny256ahk
Posts: 24
Joined: 04 Dec 2014, 07:47

Re: Run an SQL INSERT statement against an Oracle database

06 Mar 2015, 12:12

Gio wrote:Hello johnny256ahk.

Welcome to the AutoHotkey community forums :angel:

I currently use ADOSQL() by VxE to manage a SQL Server DataBase from an AHK Script. It allows me to pass in all kinds of statements.

Usage is pretty simple, and all you need is a valid connection string, and the SQL query to be processed. A 2D table object is returned by the function, and you can access the values of the cells with:

Code: Select all

object[row, column]

Example:

Code: Select all

ConnectString := "" ; Adjust your connection string here.
Query := "SELECT * FROM Table" ; Adjust table name here.
RESULT := ADOSQL(ConnectString, query)
msgbox % RESULT[2, 1] ; First row contains the column names, so use the second.
Best wishes :thumbup:
The issue I see here is I have to pass the connection-string every time, and keep opening/closing a connection. I don't know if the performance of keeping a connection open would be better, but being able to open it and have a handle would be neat so my logging functions don't have to know the connection string!

Any thoughts on that?
User avatar
Gio
Posts: 865
Joined: 30 Sep 2013, 10:54
Location: Brazil

Re: Run an SQL INSERT statement against an Oracle database

07 Mar 2015, 11:09

The issue I see here is I have to pass the connection-string every time, and keep opening/closing a connection. I don't know if the performance of keeping a connection open would be better, but being able to open it and have a handle would be neat so my logging functions don't have to know the connection string!

Any thoughts on that?
Interesting question. I have used this function for a very long time and even succesfully implemented a multi-user application without having any major connection/performance issues, even on relatively old computers.

However, you may be right, and i just haven't investigated the function deeply enougth to answer your question. I will ask VxE about this in the functions topic :thumbup:
User avatar
tank
Posts: 2825
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Irving TX
Contact:

Re: Run an SQL INSERT statement against an Oracle database

07 Mar 2015, 20:26

johnny256ahk wrote: Do you mean an externally configured ODBC connection, or done through AHK? I have vague memories of setting up DSNs but am not sure if this is what you're referring to.
yes
you can configure with ahk using regwrite
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
Check Out WebWriter
Thanks Tank :thumbup:
User avatar
masheen
Posts: 295
Joined: 06 Dec 2016, 14:10

Re: Run an SQL INSERT statement against an Oracle database

18 Jun 2017, 03:31

Can i connect to database mySQL on my Hosting with this?

Return to “Ask For Help”

Who is online

Users browsing this forum: aifritz, Albireo, Google [Bot], Lystig, vsub and 333 guests