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!
Related
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.
I know that there are many sources on the Internet on how to do that, but non of them is exact.
Can anybody write clear steps on what have to be done (downloaded, together with links) to connect to oracle database from SSRS, and where to find connection string names from Oracle.
Using:
SQL Server 2012
Oracle Database 11g Enterprise Edition
for example, this link https://support.microsoft.com/en-us/kb/834305, says that I have to install oracle client tools, I typed that in Google, and brought me to this page http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html, I've chose my OS type and downloaded the file, unzipped it, tried to run exe files, but non of them runned. Maybe I don't have to run exe files, or where should I put that folder?
Here are the steps:
Download the right Oracle client (based on your Operating System) from following link http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
After installing it, navigate to <Installed_Location>/app/<user_name>/product/client/network/admin
Open the tnsnames.ora file and add the entry (example given below)
ORA12DB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.0)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORA12)
)
)
To make sure you have installed the client properly and set the right entry in tns file, please do the following:
(i) Open command prompt
(ii) Type tnsping ORA12DB
(iii) Hit Enter key
(iv) You should see a successful message that says; tns adapter is able to resolve the alias. OK.
Once all the above steps are performed, provide that same alias name (in the above example, it was ORA12DB) in "Connection String" in the SSRS.
Just to lay the ground work:
On a 64bit Windows server we have a 64bit install of SQL Server 2008 R2
We installed a 32bit version of SQL Server Express on the same machine
Using the 32bit Express version, we successfully created a linked server to a Timberline data store as follows:
EXEC sp_addlinkedserver
#server = 'TimberlineTest',
#provider = 'MSDASQL',
#srvproduct='Timberline Data',
#datasrc = 'TimberlineDSN'
This then returns all of the tables:
exec sp_tables_ex 'TimberlineTest'
We also created a user as follows:
EXEC sp_addlinkedsrvlogin
#rmtsrvname = 'TimberlineTest',
#useself = 'False',
#rmtuser = 'sa',
#rmtpassword = 'xxxxxx'
GO
Also, within a SSMS query window, this works great when run against the Master db:
select * from timberlinetest.[c:\Training\Extended]..Master_PRM_Employee
Everything works just fine so long as we execute the queries from within SSMS. However, when we fire up any sort of third party tool that might try to access that linked server, we start running into trouble. We have a little query testing tool that allows you to enter a connection string and run queries. We're using this connection string to first get to the Master db:
Provider=SQLOLEDB; Data Source=localhost\SQLEXPRESS32BIT; Libraries=Master; User ID=sa; Password=xxxxxx
That connection works, and we can ping the server and query the Master db. But when we try the same Timberline query (select * from timberlinetest....) we run into this error:
Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "timberline test". OLE DB provider "MSDASQL" for linked server "timberline test" returned message "[Sage Timberline Office][Sage Timberline Office ODBCDriver][DRM File Library] Invalid account name."
A couple of things to note... for testing purposes:
On the directory c:\Training\Extended we have opened security wide up, setting Everyone to full read-write permissions
Within Timberline itself, we disabled security (Tools > Security Admin > Security Settings > Unchecked "Turn On Application Security")
I'm not sure what else to do here. Any advice would be great.
(Answered in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )
The OP wrote:
Problem solved.
I changed the connection string to:
Provider=SQLOLEDB; Data Source=.\sqlexpress32bit; Libraries=master; Trusted_Connection=Yes
And that worked!!
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 am using matlab database toolbox to extract data from Server. I am not familiar with SQL database apart from how to establish a connection from matlab using sql query. How can I check matlab is using which drivers to access the database as I mistakenly changed the drivers via 'Define ODBC data source' in query builder to MYSQL ODBC 5.1 Driver, due to that
con_semilib = database('checkdatabase','root','*******')
e=exec(con_semilib,['SELECT *FROM movies WHERE movie_id=1 ']);
e=fetch(e);
e.Data %e.Data is giving me ans=0
Any suggestions, I am not so familiar with database toolbox. Thanks
Adding to it, it was working fine before I messed with this define ODBC datasource