My database is on an Azure server. And I'm trying to connect to it via an ODBC driver (by the way, I tried to install it manually, but I couldn't get it. They say it's built in). I get the following error: "Data source not found and no default ODBC driver specified: Unable to connect"
dataBaseKnowFood = QSqlDatabase::addDatabase("QODBC");
QString connectString = QStringLiteral("myconnectionstring");
dataBaseKnowFood.setDatabaseName(connectString);
dataBaseKnowFood.setPassword("dgf");
dataBaseKnowFood.setUserName("gidgfsg");
if (!dataBaseKnowFood.open())
{
QMessageBox::critical(this, "Programm", dataBaseKnowFood.lastError().text());
}
Problem solved. It was required to update this driver and indicate the version of the updated driver in the connection string.
Related
I'm attempting to follow the guide here which shows how to link an azure cosmos-db as a linked server via ODBC. I have created the ODBC links to the remote cosmos-db in both x64 and x86 flavours. These appear to connect without issue when checking from within the ODBC Admin console and I can even see the data when setting up a schema, however I am unable to create a working linked server as I get the following error when testing the connection ..
"[microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
I Believe this is maybe because I have SQL Express installed and the "Providers" folder is missing from the "Linked Server" folder. I am therefore assuming that I do not have the necessary providers installed on the SQL Server Instance running locally.
I have attempted to install both the OLE DB Driver and the ODBC Driver, however these have not helped.
I'm trying to connect RStudio on MacOS 10.12 to a SQL Server instance out on the network.
I tried installing RODBC via install.packages("RODBC"). This failed with the error:
configure: error: "ODBC headers sql.h and sqlext.h not found"
I understand Mac OS and RStudio use iODBC, but those headers are part of unixODBC, so I installed that via brew install unixODBC. That solved the RODBC install at least, and now I'm able to load that library successfully in RStudio via library(RODBC).
Next I installed ODBC Manager from http://odbcmanager.net and the Actual SQL Server driver from Actual Technologies. I was then able to setup a DSN pointing at my local SQL Server, which looks like this in /Library/ODBC/odbc.conf:
[ODBC Data Sources]
sqlbox = Actual SQL Server
[sqlbox]
Driver = /Library/ODBC/Actual SQL Server.bundle/Contents/MacOS/atsqlsrv.so
Description = SQLBox
Server = sqlbox.mydomain.com
UserID = myuser
UseKeychain = Yes
ServerName = sqlbox
host = sqlbox.mydomain.com
client charset = UTF-8
Now when I request a connection in R via conn<-odbcDriverConnect("sqlbox") I get this error:
Warning messages:
1: In odbcDriverConnect("sqlbox") :
[RODBC] ERROR: state S1092, code 0, message [Actual][SQL Server] Invalid option
2: In odbcDriverConnect("sqlbox") : ODBC connection failed
Obviously it is finding the DSN, and loading (or at least finding) the Actual driver, but something is still off. The ODBC Manager tool does not have a Test button to validate a connection, so I can't try that. Is there another tool which would give better feedback on why the connection is failing? What am I missing?
Removing the system DSN and recreating it as a user DSN (in ~/Library/ODBC/odbc.ini) seems to have solved it. I'm now able to connect and pull SQL Server data from R.
I am using SQL Server 2008 R2 and my PC is 32 bit. I created an ODBC Data Source in the "Administrative Tools". I used the server name (My PC name)\SQL2008R2 which is the instance name and I used Windows Authentication instead of using username and password.
In Lazarus, I used the ODBC Connection and when I try to set the property "Connected" to true I get this error:
And I tried to use also the SQL Server connection with the "dblib.dll" and got an error.
Note: I tried to paste the dll file in C:\Windows\System32 folder and in the C:\lazarus but still getting same error.
I've no experience with Pascal/Lazarus, but the ODBC error message in the first screenshot suggests that the property names in the Lazarus configuration screen don't match the property names used by ODBC; the error says:
Could not connect with connection string "DSN=jbs..."
Based on the screenshot of your ODBC system DSN, the DSN name is DBSource. Try setting value of the DatabaseName to DBSource in the Lazarus ODBC connection configuration screen.
I am trying to connect to my local MS SQL SERVER 2008 R2 using JDBC. I get the following error
BW-JDBC-100034 "Configuration Test Failed. Exception [java.sql.SQLException] occurred.
java.sql.SQLException: No suitable driver found
I have already verified the following
SQLJDBC.jar is in the path TIBCO_HOME\tpcl\5.8\jdbc & TIBCO_HOME\tpcl\5.8\LIB
The classpath tibco.env.STD_CP_EXT is set to the path TIBCO_HOME\JDBC in the designer.tra file.
Still I get the BW-JDBC-100034 error. Kindly advise
Could you please provide the jdbc driver you are using in this JDBC Connection activity? If you are using Microsoft driver you have to use the sqljdbc4.jar as you have already used. If you are using a tibco driver however, you need the TISql.jar which you can obtain by installing the product TIBCO-dbdrivers-2.0 from download.tibco.com.
Happy that you were able to fix the issue.
I'm trying to open MS Access db file with QT in Linux.
So, I have installed odbc plugin for qt:
sudo apt-get install libqt4-sql-odbc
Now there are 2 files qt4/plugins/sqldrivers directory: libqodbc.so & libqsqlite.so
So, I try to use ODBC plugin in my project. There is connection function:
bool createConnection()
{
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DSN='';DBQ=/home/user/personal_base.mdb");
if (!db.open()) {
QMessageBox::warning(0, QObject::tr("Database Error"), db.lastError().text());
return false;
}
return true;
}
But application dislpays error:
[unixODBC][Driver Manager]Data source name not found, and no default driver specified QODBC3: Unale to connect
How should I fix it?
The call to setDatabaseName ends up in the ODBC function SQLDriverConnect. SQLDriverConnect defines a number of attributes you can set to declare which ODBC driver you are using and how to use it e.g., DRIVER. You told the unixODBC driver manager to load the driver "Microsoft Access Driver (*.mdb, *.accdb)" and it could not find that driver.
In unixODBC, drivers are usually defined in the odbcinst.ini file which you can usually find with the command "odbcinst -j". You'll find this article useful.
It is highly unlikely you have a Microsoft Access driver named as you've shown as this is usually the name of the MS Access driver which is only available on Windows.
To my knowledge there are only 2 ways to access MS Access DB directly from Linux using ODBC 1) mdbtools (which is old and incomplete but free) 2) Easysoft MS Access ODBC Driver which is a complete ODBC Driver but not free.
I had The same Problem with my project except that I'm using Windows. I think that this will help you:
Just change Your Driver into this Code(taken from QT Website):
db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=myaccessfile.mdb");