odbc

Connect to an Access database with ODBC via ASP.net

Hi there I'm trying to set an ODBC connection to a MS Access, with an Asp.net app. I keep getting this error message: ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] The Microsoft Office Access database engine cannot open or write to the file '(unknown)'. It is already opened exclusively by another user, or you need permission ...

How to update GUID in MS SQL via PHP/ODBC?

I've been tasked with getting two MS SQL based products to synchronize. My predecessor was content to match records based on a combination of name and address, but both systems have a GUID, and only one is actually using it. So my thought was to match up my existing records and copy the GUID from one database to the other. But I can't se...

how to import data from DBF to SQL using SQL script?

I am trying to import data from DBF file to SQL table using the following command - select * from openrowset('MSDASQL', 'Driver={Microsoft dBase Driver (*.dbf)};DBQ=E:\data\;', 'select * from E:\data\a.dbf') But it is failing saying OLE DB provider "MSDASQL" for linked server "(null)" returned message "[Microsoft][ODBC dBase Dr...

Calling SQL Server stored procedures via ODBC fails, leaving empty tables

We are using ODBC from C on Linux. We can successfully execute direct statements ("INSERT ...", "SELECT ...", etc) using ODBC for both SQL Server 2008 and MySQL. We are migrating to stored procedures, so we first developed MySQL stored procedures. Calling MySQL stored procedures using ODBC works. Life is good. The stored procedures are ...

Is ODBC from MARS but ADO/OLEDB from VENUS?

Short question: I am finding I need to use MARS over ODBC but not over ADO/OLEDB, is that correct? Longer explanation: I just discovered my ODBC code (using "Driver={SQL Native Client}", MFC CDatabase code) needs to have MARS ("MARS_Connection=yes;") because, although I do not issue multiple SELECTs when opening a RecordSet, I do fetch...

Problems with string parameter insertion into prepared statement

Hi, I have a database running on an MS SQL Server. My application communicates via JDBC and ODBC with it. Now I try to use prepared statements. When I insert a numeric (Long) parameter everything works fine. When I insert a string parameter it does not work. There is no error message, but an empty result set. WHERE column LIKE ('%' ...

Freetds forbidding connection when run as sudo

I have a rails app that uses freetds to establish an ODBC connection into a SQL Server Database. This app is on a server running under mongrel, in theory. If I start the app with: sudo mongrel_rails start -e development -p 9000 -d I get S1000 (0) [unixODBC][FreeTDS][SQL Server]Unable to connect to data source However, when run w...

Get Number of Rows from a Select statement

Hello all, I have this: $dbh = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=$mdbFilename", $username, $password); $sql = "SELECT * FROM this_table"; $stmt = $dbh->query($sql); //num of rows? How do I get the number of rows returned from that SELECT statement? Thanks all ...

Connection timeout in ODBC

I know that I can set the connection timeout for MS SQL Server when using ADO or OLE DB, by adding Connect Timeout=somevalue to the connection string. This doesn't seem to work for ODBC connections though. Specifically, we made the decision to use the standard SQL Server ODBC driver that ships with Windows XP (SQLSRV32.DLL version 2000....

How do I get a list of fields returned by an OdbcDataReader?

How can I get a list of fields from OdbcDataReader in C#? For example, for a table with two fields, Field1 and Field2: DbCommand.CommandText = "SELECT * FROM TABLE WHERE 0=1"; DbReader = DbCommand.ExecuteReader(); DbReader.??? would give to me a list of two elements - ["Field1","Field2"] Is there such a function? ...

Why does my ODBC SelectCommand get truncated when I add a parameter.

I am using an ODBC connection to retrieve a data set in C#. I can see that the full command string is added to the connection when it is created. OdbcDataAdapter dataAdapter = new OdbcDataAdapter(GetCommandString(), odbcConnection); I am using the following line to add the parameter to the command string. dataAdapter.SelectCommand.Pa...

TSQLConnection to a user chosen DSN at runtime

Hi, I want to use dbExpress and a TSQLConnection object to allow the user of my application to connect to any of their ODBC dsn and run a SQL query against it. I have it so the user can select a DSN, (by DSN i mean all the configured data sources listed in control panel - administrative tools - Data Sources (ODBC)), but once they have ...

CRecordset AddNew produces exception

Hi all, I have a C++ class derived from CRecordset used to add registers to a .mdb file. When my class calls CRecordset::AddNew I get an exception during the execution of AddNew. I use the following code to open the recordset and add the new register: if (Open(CRecordset::dynaset, L"SELECT * FROM Alumnos", CRecordset::none)) { if (Ca...

How can I create an ODBC connection to SAS?

I'm writing a program that needs to access SAS data. I've downloaded the ODBC drivers for SAS and installed them, but I need to be able to create ODBC connections on the fly, programmatically. The following code (in Python) seems like it should work: import ctypes ODBC_ADD_DSN = 1 def add_dsn(name, driver, **kw): nul, at...

VFPODBC very slow

I'm using an MS Access 2003 front end to access the data on a network drive owned by a Visual Foxpro 9 application via odbc, and it seems to be unbelievably slow - there's about 1400 records in one particular table, and it takes a good minute to load up on the Access interface, although when using a basic DBF viewer, or the application t...

MSAccess and ODBC. Filter dialog doesn't show

Hi All. I have problem with Microsoft Access Database connected via ODBC to Postgresql database. Filter dialog - for filtering data using multiple selectable checkboxes: doesnt work. EDIT: Doesn't work: I'mean there is no checkboxes to select. There is only options for sorting A-Z and Z-A. How to fix this? I can sort data, I can fi...

PDO PHP query against Teradata using ODBC connect string returns no data from 5th column onwards

I'm using PDO to extract data from Teradata, using an ODBC connect string. The query returns the correct number of rows but column 5 onwards is blank (as compared to using the same query with the PHP ODBC library) Column 5 happens to be a varchar(400) field and I've read that PDO had bugs in the past with varchar columns > 255 in lengt...

What is the easiest and most reliable MySQL data provider for .NET Apps?

There are a couple of data providers to interface with MySQL databases from .NET Apps. Which in your experience have you found the easiest to work with and most reliable? MySQL .NET Connector MyODBC dotConnect for MySQL other I've never done this before so I want to walk down a path that's tried and tested. ...

Parameterized DB2 Query From .NET

I am attempting to run a parameterized query against a DB2 database from .NET using the Client Access ODBC Driver using the following code: var db2Cmd = new OdbcCommand("INSERT INTO presnlats (LAT) VALUES (@LAT)", db2Conn); db2Cmd.Parameters.AddWithValue("@LAT", insertValue); Console.Out.WriteLine(db2Cmd.ExecuteNonQuery()); When execu...

Login Access 2007 with ODBC linked table from Oracle

Hi, I'm migration Access 2003 to 2007. There are a lot of linked table from Oracle. I create a ODBC point to Oracle instance, then in Access I link all table through ODBC. I use this code login, so the "Oracle ODBC Driver Connect" dialog box would not popup to ask password: strConnect = "ODBC;DATABASE=" & strFCPD & ";DSN=PBRIS;UID=...