odbc

Where can I manage Server Objects?

How do I link an odbc object to a stored procedure I have written. Please see example below: The following code executes a stored procedure called DEPT_Add, yet the name of the object function is AddDepartment. Set oDept = Server.CreateObject("JTQTMS.JTDept") bReturn = oDept.AddDepartment(CStr(sDeptName)) My question is if I add a...

Using Parameters with an Oracle ODBC Connection

I'm connecting succesfully to an Oracle 10g DB with an the Microsoft ODBC for Oracle driver. Regular queries without parameters work fine, but parameterized queries act as if the parameters aren't getting passed in. ex. --this works fine Select * from tbl1 where column1 = 'test' --this doesn't select * from tbl1 where column1 = ? --...

Why do I get a Timeout Expired error running this query?

I'm running this query on SQL Server 2008 using ODBC. If I take out the last part (OR li.DATEGENERATED >= (...))) then I don't get the error... but I can run it in SSMS just fine. SELECT COUNT(*) FROM dbo.POITEMST li WHERE (? IS NULL OR li.DATEGENERATED >= ?) AND (? IS NULL OR (li.DATEGENERATED >= ( SELECT MAX(t.DATEGENERATED) F...

Why doesn't Win32::ODBC find the ODBC.dll under Perl 5.10 and Cygwin?

I'm trying to use Perl ODBC to connect to a Microsoft SQL server. My problem is that Perl 5.10.0 is having a problem using the Win32 ODBC driver. If I run a Perl shell and execute this one line, I get errors. use Win32::ODBC; Can't load '/usr/lib/perl5/vendor_perl/5.10/i686-cygwin/auto/Win32/ODBC/ODBC.dll' for module Win32::ODBC: No ...

Microsoft SQL Server Statistics via ODBC

I have an instance of SQL Server that I am trying to benchmark. From the SQL Studio application I can type SET STATISTICS TIME ON and see outputted statistics after that. From C++ code, I can do something like SQLExecDirect(hstmt, "SET STATISTICS TIME ON", SQL_NTS); and then retrieve these statistics via SQLError. Is there a way t...

PyODBC and Microsoft Access: Inconsistent results from simple query

I am using pyodbc, via Microsoft Jet, to access the data in a Microsoft Access 2003 database from a Python program. The Microsoft Access database comes from a third-party; I am only reading the data. I have generally been having success in extracting the data I need, but I recently noticed some discrepancies. I have boiled it down to ...

SQLGetDiagRec causes crash in Unicode release build

I'm having a problem with the call to SQLGetDiagRec. It works fine in ascii mode, but in unicode it causes our app to crash, and i just can't see why. All the documentation i've been able to find seems to indicate that it should handle the ascii/unicode switch internally. The code i'm using is: void clImportODBCFileTask::get_sqlError...

simple remote ODBC database connection with ruby

I am attempting to make a simple connection to a remote database. I can not seem to get it to work. remote_db = DBI.connect('DBI:ODBC:remote-host','user','password') remote_db.table { |table| pp table } Any help would be greatly appreciated. ...

How to write an Excel function which returns a value from an SQL database?

Hi all, I want to write the following function which should be used in an Excel worksheet: =GetRecField("Foo Record Key", "FooField1") ...which will connect internally through ODBC to an SQL database, execute there an SELECT FooField1 FROM MyTable WHERE KEY_FIELD='Foo Record Key'; and will return the resulting value as the result ...

With CDatabase, can I send SQL without using CRecordSet?

When using the MFC class CDatabase to connect to a data source, is there any way to execute SQL statements without having to open a CRecordSet object? I ask because CRecordSet::Open() appears to throw an exception when I use it to call stored procedures that don't return anything - and there's no reason to expect results from, say, sp_d...

catch odbc exception

I need to recognize in my application whether table doesn't exist or has no rows to take appropriate action. Can I catch this two errors separately ? >>>cursor.execute("delete from TABLE") Traceback (most recent call last): File "<interactive input>", line 1, in <module> dbi.internal-error: [IBM][CLI Driver][DB2] SQL0100W No row was...

Python equivalent of perl's dbi/DBD::Proxy access? (Perl DBI/DBD::Proxy for Python)

I have a perl script that interfaces with an existing database (type of database is unknown) through the DBI module, that I would like to access in python 2.6 on winXP. The perl code is: use DBI; my $DSN = "DBI:Proxy:hostname=some.dot.com;port=12345;dsn=DBI:XXXX:ZZZZZ"; my $dbh = DBI->connect($DSN); Can this be translated into a pyth...

Specify a default driver for ODBC

I have a legacy VB6 app which builds a DSN based on a parameter in a config file. The parameter is an ODBC connection, and the connection has a name (DSN-NAME) which maps a server (DBSERVER) to a driver ("SQL Server Native Client"). Generally, it builds a DSN like this: DSN=DSN-NAME;User=foo;Password=bar If I specify a hostname i...

When programatically creating a DSN for an Oracle database how can I reliably tell the driver name?

I have an application that connects via a DSN to an Oracle database. If the initial attempt to connect fails, then I make sure their DSN exists. If it does not exist, then I create it using the SQLConfigDataSource command. That command requires the driver name as one of its arguments. On my machine, I have the 11g driver, so the follo...

Can I get the primary key of an inserted row, using ODBC?

What is the best way to retrieve the primary key of an inserted row, when using ODBC objects in .NET? For example (VB): Dim command As OdbcCommand = gOdbcConn.CreateCommand() command.CommandText("INSERT INTO auhinode (node_key, node_desc) VALUES (0, 'New Node')") ... Dim result As Integer = command.ExecuteNonQuery() I've seen a coupl...

How to work with ASP.NET MVC and ODBC 2.0

I am starting out on a project that will involve ASP.NET MVC using a legacy ODBC 2.0 compliant database. The goal is to replace current system functionality with a web front end over a period of maybe a year then swap out the backend with SQL Server. The plan would be to code against SQL server then insert some shim into the repository...

Options to Replicate Microsoft SQL Server Database to MySQL/PostgreSQL on Linux

I need to replicate data from Microsoft SQL Server to MySQL or PostgreSQL. The data includes images stored in BLOB columns. Could you please comment on your experiences with the following strategies and suggest others I may have missing? custom script written in Java using JDBC linux odbc driver with perl script Setup my own windows ...

possible type of database that uses dat, idx files

i have an application that was written in delphi it is fairly recent, running on win32 i want to hook into the database with odbc but i am unsure which database driver to use the directory with the database has .dat .idx files for each table it is a standalone database not client server (as far as i can tell) any ideas what type of dat...

ODBC connect with propritary driver/Excel Trust settings

I have a spreadsheet in Excel that connects to an internal DB using the odbc driver for the software (Action Request System). That works fine. Now I'm trying to move the Excel file to a SharePoint site so that our team can review the data and make notes in the same spreadsheet. So, first I tried just moving the Excel file to the server,...

Is it better to use the Perl DBI module or to set up a system DSN and use ODBC?

I am using Perl to collect data from several logfiles and store it into an Oracle database on the same Windows 2003 host I am running my script on. Is it better to use the Perl DBI module or to set up a system DSN and use ODBC? Thank you ahead of time! Michael ...