avatar

Andres Jaimes

Calling a DLL from MQL

There are times when we want access to additional data structures and function libraries than the ones provided by MetaTrader’s MQL. Besides native open-source MQL options, we can create our own Dynamic Link Library (DLL) in C# or C++ and link …

From MySQL to Postgres - Useful commands

This article shows a list of basic commands on MySQL and their corresponding versions for PostgreSQL.

Connecting to a database

MySQL

1$ mysql -u root -p

Postgres

1$ psql -h <host> -U <username> <database-name>

Try the following if …

Storing MySQL credentials on a file

MySQL allows you to store credentials in a file called ~/.my.cnf. The contents can look like this:

[mysqldump]
user=myuser
password=mypassword

We have to modify the file permissions and give read/write permissions to the owner only:

1chmod 600 …

Common tasks when working with MySQL

How to install MySQL server in Ubuntu

It’s pretty simple:

1sudo apt-get install mysql-server

How to connect to MySQL using Java

This is a useful and simple snippet:

 1import java.sql.Connection;
 2import java.sql.DriverManager;
 3public class Test { …

Create a connection to MySQL in Java

This time we are going to create a basic connection to MySQL in Java and pull some data from it.

// Compile it:
// javac Mysql.java
//
// Try it:
// java -classpath mysql-connector-java-5.1.27-bin.jar:. MySQL

import java.sql.Connection;
import …