odbc

Force SET IDENTITY_INSERT to take effect faster from MS Access

跟風遠走 提交于 2019-11-29 15:52:30
I'm working on upsizing a suite of MS Access backend databases to SQL Server. I've scripted the SQL to create the table schemas in SQL Server. Now I am trying to populate the tables. Most of the tables have autonumber primary keys. Here's my general approach: For each TblName in LinkedTableNames 'Create linked table "temp_From" that links to the existing mdb' 'Create linked table "temp_To" that links to the new SQL server table ExecutePassThru "SET IDENTITY_INSERT " & TblName & " ON" db.Execute "INSERT INTO temp_To SELECT * FROM temp_From", dbFailOnError ExecutePassThru "SET IDENTITY_INSERT "

Connecting to an MSSQL database from a Ruby on Rails application running on Ubuntu

三世轮回 提交于 2019-11-29 15:11:42
问题 I have a situation where I'm trying to build a web app which takes a total count of records in a table and outputs it to the screen. Sounds simple right...? The main problem I'm having is that the DB I want to look at is MSSQL. I haven't set up this kind of DB connection from Rails before so I was hoping someone could point me in the right direction. My RoR application will live on a Ubuntu server (and is being developed on a OSX Leopard system). EDIT: I should clarify that the MSSQL DB is

Reading columns out of order returns incorrect values (SQL Server ODBC driver)

拈花ヽ惹草 提交于 2019-11-29 14:54:25
This question is part in a series of bugs in the Microsoft ODBC driver: ODBC driver fails to raise errors; but instead suppresses them Reading columns out of order returns incorrect results Cannot execute a stored procedure that is a SYNONYM Microsoft has said they will not be fixing these bugs in their ODBC driver. Short Version If i read uniqueidentifier values in SELECT order, i am returned the correct values: ColumnB : (read valid value) ColumnC (read valid value) If i read uniqueidentifier column values outside of select order, the earlier columns return nothing (and sometimes junk):

How to bind ISO8601 TSQL DATETIME parameter with PDO?

半腔热情 提交于 2019-11-29 14:43:39
It seems that PDO has a problem with ISO 8601 formatted timestamps. I'm connecting from 64-bit Ubuntu 16.04 running PHP 7.0.8 using the Microsoft® ODBC Driver 13 (Preview) for SQL Server® Here's my simple table: CREATE TABLE dtest ( "stamp" DATETIME ); Works: $pdoDB = new PDO('odbc:Driver=ODBC Driver 13 for SQL Server; Server='.DATABASE_SERVER.'; Database='.DATABASE_NAME, DATABASE_USERNAME, DATABASE_PASSWORD ); $pdoDB->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $sql = "INSERT INTO dtest (stamp) VALUES ('2011-03-15T10:23:01')"; $stmt = $pdoDB->prepare($sql); $params = []; $stmt-

Java ODBC Data Source ( undefined symbol: SQLAllocEnv )

风流意气都作罢 提交于 2019-11-29 14:21:21
I have the following Java code. Purpose of this code is to establish a connection to a remote MySQL database ProductionDb ( a data source defined in my /etc/odbc.ini file ). import java.sql.*; import java.util.*; import java.io.*; public class Test { public static void main(String[] args) { try { Connection conn = null; PreparedStatement s = null; String driver = "sun.jdbc.odbc.JdbcOdbcDriver"; Class.forName(driver).newInstance(); conn = DriverManager.getConnection("jdbc:odbc:ProductionDb"); } catch (Exception ex) { System.out.println(ex.getMessage()); } } } The /etc/odbc.ini file is: $ cat

pyodbc + MySQL + Windows: Data source name not found and no default driver specified

百般思念 提交于 2019-11-29 14:03:27
问题 I am trying to connect to MySQL 5.6 on a Windows Server 2008 R2 localhost with pyodbc. I used the full installation for the MySQL instance on the localhost, including the ODBC connector. I have it connecting to a remote SQL Server instance beautifully, but for the life of me I can't get it to connect to the local MySQL instance. I am using this guide from connectionstrings.com as reference. Here's some code: import pyodbc def create_mssql_conn(): return pyodbc.connect(r'Driver={SQL Server}

Encoding problems with dBase III .dbf files on different machines

本秂侑毒 提交于 2019-11-29 12:59:03
I'm using C# and .NET 3.5, trying to import some data from old dbf files using ODBC with Microsoft dBase Driver. The dbf's are in dBase III format and using ibm850 encoding for strings. Now, when I run my program on my machine, all string data read from OdbcDataReader comes out converted to UTF-16 or UTF-8 or something, idk and I save it as UTF-8 and everything is ok, but when I try to use this program on an XP box, some characters aren't converted correctly to UTF-8. 'Õ' for example. There may be some others too. Characters like 'Ä', 'Ö' and 'Ü' are ok. This is the problem. Maybe the ODBC or

What is the proper odbc command for calling Oracle stored procedure with parameters from .Net?

江枫思渺然 提交于 2019-11-29 12:55:00
In the case of MSFT SQL Server 08, it is: odbcCommand = new OdbcCommand("{call " + SP_NAME + " (?,?,?,?,?,?,?) }", odbcConn); When I try to do the same thing for Oracle, I get: OdbcException: ERROR [HYC00] [Oracle][ODBC]Optional feature not implemented. Feel free to ask for clarification, and please help. I am using .Net 3.5, SQL Server 08, and Oracle 11g_home1. P.S. The Oracle stored procedure does have some 3 more parameters, but I believe I am handling this in my code. I'm running .NET 3.5 and Oracle 10gR2. I've added an output parameter in response to your comment. Server , Uid , and Pwd

Using pyodbc cause error: Data source name not found and no default driver specified

与世无争的帅哥 提交于 2019-11-29 12:20:00
I'm using pyodbc to connect SQL Server. I had created connection string like this: from sqlalchemy import Table, Column, databases, Integer, String, ForeignKey, create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import session engine = create_engine('mssql+pyodbc://sa:123@localhost/TrainQuizDB') engine.connect() TrainQuizDB is database name that I created in Sql Server. For more information I have windows 8.1 64bit and I installed python version 3.5.1 32bit and I downloaded pyodbc from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyodbc (pyodbc-3.0.10-cp35

Generic SQL that both Access and ODBC/Oracle can understand

删除回忆录丶 提交于 2019-11-29 12:07:29
I have a MS Access query that is based on a linked ODBC table (Oracle). I'm troubleshooting the poor performance of the query here: Access not properly translating TOP predicate to ODBC/Oracle SQL . SELECT ri.* FROM user1_road_insp AS ri WHERE ri.insp_id = ( select top 1 ri2.insp_id from user1_road_insp ri2 where ri2.road_id = ri.road_id and year(insp_date) between [Enter a START year:] and [Enter a END year:] order by ri2.insp_date desc, ri2.length desc, ri2.insp_id ); The documentation says: When you spot a problem, you can try to resolve it by changing the local query. This is often