Connect to Database

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
(Created page with "$Connect to Database is a Database Command. - This command is used to open a connection to a database. - Currently it can only connect to MySQL, but mor...")
 
 
(6 intermediate revisions by one user not shown)
Line 1: Line 1:
$Connect to Database is a [[Database Commands|Database Command]].
+
Connect to Database is a [[Database Commands|Database Command]].
  
- This command is used to open a connection to a database.
+
* This command is used to open a connection to a database.
- Currently it can only connect to MySQL, but more databases will be available in the future.
+
* Currently it can connect to MySQL, MS SQL databases.
- To interact with a database you will use this command, and drag in either the query command or query with results command.
+
* To interact with a database you will use this command, and drag in either the query command or query with results command.
- You can use the wizard to setup the Connection Url parameter. The wizard also allows you to test the connection.
+
* You can use the wizard to setup the Connection Url parameter. The wizard also allows you to test the connection.
 +
 
 +
 
 +
== Example ==
 +
 
 +
<pre>
 +
plugin command("DatabaseCommands.dll", "connect to database", "server=localhost;uid=test; pwd=testing; database=mysql; port=3306; pooling=false") {
 +
    plugin command("DatabaseCommands.dll", "query", "INSERT INTO users VALUES (\'ubot\', \'studio\');")
 +
    plugin command("DatabaseCommands.dll", "query with results", "SELECT * FROM users WHERE username = \'ubot\';", &users)
 +
}
 +
</pre>
 +
 
 +
[[File:connectdb.jpg]]

Latest revision as of 12:06, 20 June 2014

Connect to Database is a Database Command.

  • This command is used to open a connection to a database.
  • Currently it can connect to MySQL, MS SQL databases.
  • To interact with a database you will use this command, and drag in either the query command or query with results command.
  • You can use the wizard to setup the Connection Url parameter. The wizard also allows you to test the connection.


[edit] Example

plugin command("DatabaseCommands.dll", "connect to database", "server=localhost;uid=test; pwd=testing; database=mysql; port=3306; pooling=false") {
    plugin command("DatabaseCommands.dll", "query", "INSERT INTO users VALUES (\'ubot\', \'studio\');")
    plugin command("DatabaseCommands.dll", "query with results", "SELECT * FROM users WHERE username = \'ubot\';", &users)
}

Connectdb.jpg

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox