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)
Related
I want to use exist db on mysql from mvc asp.net.
I installed mysql plugin for vs and mysql connector net.
Add connection string to config.
When I start vs in server explorer I see working connection, but when in project I try to add new ado.net entity data model -> generate from database wizard don't know about mysql in general, there are defaultconnection to MS sql and only two varients for new connection:
Microsoft SQL Server
Microsoft SQL Server Database file
Other
Maybe I forgot something install?
Thanks for help.
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 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
I have connected both database, but used two connection string. Is there any possible to connect by using one connection string for both.
in Perl, the DBI architecture is split into 2 main groups of software : DBI itself and the Drivers(DBD). Each RDBMS has its own driver in Perl, and each driver has a connection string linked to it. You cannot make a "unified" connection string.
I want to use MYSQL database for accesssing the data in a mvc application.
The connection string that i am using in web.config is:
Then I have prepared a model,controller,view for accessing and displaying the data.
I am using LINQ o get the data from database but getting the exception:" A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"
I have also installed the MYSQL connector.
Please provide me the solution to access the data using MYSQL and LINQ in MVC application
Thanks in advance.
Deleting my previous answer...I read your question as LINQPad, no idea why.
To be short, get a third party provider, I can't speak for others, but devart's dotConnect for Oracle has worked very well for us: Here's their MySQL version.
You could use NHibernate and Linq-to-Nhibernate and then you are not database tied.
NHibernate Files
http://sourceforge.net/projects/nhibernate/files/
But this I guess is dependent on how much time you have to develop!
You can't use LINQ to SQL. You should use entity framework.
Linq to SQL is only for MS Sql.
Use EF to work with any other DB, and then you can use LINQ to EF.
Linq to SQL is obsolete
http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-and-linq-to-entities-roadmap.aspx
LinQ to Sql is used to Connect the MsSql to LinQ.We need third party softwares to Connect LinQ with MySql.
I Can Connect LinQ and Mysql with the help of DbLinq
Refer this Sites
http://www.primaryobjects.com/CMS/Article100
https://olgatherer.wordpress.com/2010/08/19/dbmetal-isnt-hard/