What would be the ODBC equivalent of the following:
hconn = database('{schema name}','{username}','{password}',...
'com.mysql.jdbc.Driver',...
'jdbc:mysql://{hostname}:{port}/{schema name}?...
useSSL=true&requireSSL=false&autoReconnect=true&');
I am using MATLAB's Database Toolbox Version 7.1
You can use the following code to perform a traditional connection to the database specifying the ODBC data source name (ODBC DB for example):
conn = database('ODBC DB','myuser','mypass');
If you want to use Windows Authentication instead, all you have to do is to specify the authenticated ODBC data source name (ODBC DB AUTH for example) and provide blank username and password:
conn = database('ODBC DB AUTH','','');
Refer to this page for more information.
Related
I am setting up the Reporting Servers for a SQL server that I am migrating and one of the data sources connects to Teradata. I am able to connect fine using the DB username and password but when I try to use Windows/LDAP it fails to connect. My company requires it being set up with the LDAP login.
The current connection string I am using is Data Source= datasource.com; Database=db1,db2
Is there a different connection string I can use to enable LDAP within the SSRS?
Thank you in advance.
I am using vb.net and xampp for creating my project. I want to attach the database on my setup file so that i wont have to install xampp on other computer just to make it work. Do i have to install database server?
Do i have to install database server?
Only on the machine where MySQL will run, not on every machine that runs your vb.net application. Shared data residing in a shared MySQL database is the point of using database technology.
You will need to provide a connection string to every user or every machine that runs your vb.net application. That connection string must specify these items of information
the hostname or ip address of the machine running MySQL
the name of the database on MySQL used for your application
the username of the user account on MySQL with access to the database
the password for the user account.
Your connection string will look something like this:
Server=MySQLHost;Database=myDataBase;Uid=username;Pwd=password;
For example, if your server is on 192.168.1.220, the database name is saldieApp, the MySQL username is ourMySQL, and the shared password is dontTellMom, your connection string is
Server=192.168.1.220;Database=saldieApp;Uid=ourMySQL;Pwd=dontTellMom;
Your vb.net program will do something like this to connect to MySQL.
Dim conn as MySQLConnection
conn = New MySqlConnection()
conn.ConnectionString = "Server=MySQLHost;Database=myDataBase;Uid=username;Pwd=password;"
conn.Open()
The trick for installing a company-wide application using a shared database is to distribute the appropriate connection string to each user. You can put that connection string in your setup file. Or you can do something more secure that doesn't require you to store the password in your setup file.
Is it possible to execute queries joining a MySQL DB table and an Oracle DB table?
I previously worked on MS SQL Server and I linked external DB servers inside SQL Server instance to create procedures and views integrating different DB tables.
Is something similar available on MySQL or Oracle DBMSs?
As far as I know, DG4ODBC allows you to connect with the MySQL ODBC driver from an Oracle database to the MySQL database.
Since you have not mentioned the OS details, I would suggest you to check out My Oracle Support(MOS) notes for your specific OS. You can look for Oracle Database Gateway for ODBC. Here is a link to documentation http://docs.oracle.com/cd/B28359_01/gateways.111/b31042/toc.htm.
Yes, you can.
For that you use the dg4odbc (assuming oracle >= v11) in combination with unixODBC as odbc driver manager and freeTDS as odbc driver for SQLServer.
What you do is create a listener entry in your listener.ora similar to
(SID_DESC =
(SID_NAME=yourdb)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1 )
(PROGRAM = dg4odbc)
(ENVS = "LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0.3/dbhome_1/lib:/usr/local/freetds/lib")
)
create a tns alias that points to this special SID - yourdb - that is going to act as the gateway to SQLServer.
your_tns_alias =
(DESCRIPTION =
(ADDRESS_LIST=
(ADDRESS =(COMMUNITY = tcp.world)(PROTOCOL = TCP)(Host = your.db.server)
(Port = 1521)
)
)
(CONNECT_DATA =
(SID = yourdb)
)
(HS=ok)
)
mind the hs=ok entry, this tells we have to do with a gateway.
In $ORACLE_HOME/hs/admin create a file named inityourdb.ora where the configuration of the gateway comes.
HS_FDS_CONNECT_INFO = yourdsn
HS_DB_NAME = yourdsn
HS_FDS_SUPPORT_STATISTICS = FALSE
HS_FDS_SHAREABLE_NAME=/usr/local/unixODBC/lib/libodbc.so
#HS_FDS_TRACE_LEVEL=debug
HS_FDS_TRACE_LEVEL=off
HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P15
This is the interface between the Oracle rdbms environment and ODBC. Specified are the driver manager, the DSN, here also can be some tuning parameters. The DSN is as done like regular ODBC administration. Some drivers need their own special parameters, similar like ORACLE_HOME for Oracle in order to find their own administration, like error messages .... This is the file to include those pointers.
have fun!
I would like to use F# to connect to databases other than SQL Server using the same code as in : http://msdn.microsoft.com/en-us/library/hh361033(v=vs.110).aspx
I assume I need the ADO.Net connector for the database (MySQL or SQLite etc.). However, once that is done, how should I modify the connection string in :
type dbSchema = SqlDataConnection<"Data Source=MYSERVER\INSTANCE;Initial Catalog=MyDatabase;Integrated Security=SSPI;">
let db = dbSchema.GetDataContext()
To indicate I want to use MySQL or SQLite etc.
Many thanks
Connection string you're using is for Microsoft SQL Server.
MySQL connection strings: http://www.connectionstrings.com/mysql
SQLite connection strings: http://www.connectionstrings.com/sqlite
(from that links you can navigate to the proper connector you're using)
I would like to know how to connect a MySQL database to MATLAB software. I downloaded the jdbc connector but I'm not getting how to specify the path.
I suppose here that you have created a database called 'mybase' and you use 'root' user without password (don't do that in real life).
You have to remember to add the mysql connector jar file path to java classpath. You can do this by either adding the path to classpath.txt (\toolbox\local) or by using javaclasspath command directly from Matlab.
You can establish your connection like this:
dbname = 'mybase';
username = 'root';
password = '';
driver = 'com.mysql.jdbc.Driver';
dburl = ['jdbc:mysql://localhost:3306/' dbname];
javaclasspath('path-to-mysql-connector\mysql-connector-java-VERSION-bin.jar');
conn = database(dbname, username, password, driver, dburl);
http://desk.stinkpot.org:8080/tricks/index.php/2006/02/how-to-get-matlab-to-talk-to-mysql/
Let me quote:
open the classpath.txt file in [matlab path]/toolbox/local/ and add the following line to it (you can download jar file from http://dev.mysql.com/downloads/connector/j/, and after extract you can move it to under the folder : /usr/share/java)
[path to unzipped jdbc driver package]/mysql-connector-java-3.1.12-bin.jar
create a database in mysql (can look up here how to do that)
to connect to the database you’ve created (call it “foo”), type into matlab:
>> conn = database(‘foo’,’[your user name]‘,”,’com.mysql.jdbc.Driver’,'jdbc:mysql://localhost:3306/foo’)