odbc

Connect to an Oracle 10g database with Microsoft ODBC for Oracle

筅森魡賤 提交于 2019-11-28 01:22:38
问题 I'm trying to connect to an Oracle 10g database using the built in Microsoft ODBC for Oracle driver. I want to use an dnsless connection, so I grab my connection string from www.connectionstrings.com. Ideally I won't have to setup a DNS entry or an Oracle TNS entry, and I may be mistaken, but I thought the above would do that for me. I'm getting the following: ERROR [NA000] [Microsoft][ODBC driver for Oracle][Oracle]ORA-12514: TNS:listener does not currently know of service requested in

Multiple insert statements in single ODBC ExecuteNonQuery (C#)

烈酒焚心 提交于 2019-11-28 01:17:33
I'm inserting multiple rows into a DB, and joining them together in an attempt to improve performance. I get an ODBCException telling me my SQL syntax is wrong. But when I try it in the mysql commandline client, it works just fine.. I ran a simplified test to describe the process. Command Line Client: mysql> create table test (`id` int, `name` text); Query OK, 0 rows affected (0.05 sec) mysql> INSERT INTO test(id, name) VALUES ('1', 'Foo');INSERT INTO test(id, name) VALUES ('2', 'bar'); Query OK, 1 row affected (0.00 sec) Query OK, 1 row affected (0.00 sec) mysql> After that I ran this code on

How to install pyodbc 64-bit?

南楼画角 提交于 2019-11-28 00:53:45
问题 I have Python 2.7, MySQL 5.5, MySQL ODBC Connector 5.1, and pyodbc all installed on my computer, which is running Windows 7, 64-bit... Only problem is that everything is installed as 64-bit except pyodbc, which is 32-bit. When using easy_install to download pyodbc, it automatically downloads the 32-bit version. Thus, when I try to connect to my database using: cnxn = pyodbc.connect('DRIVER={MySQL ODBC 5.1 DRIVER};SERVER=localhost;DATABASE=test;UID=root;PWD=password') I get the error: Data

Correct way to escape input data before passing to ODBC

喜夏-厌秋 提交于 2019-11-28 00:20:04
问题 I am very used to using MySQL and mysql_real_escape_string(), but I have been given a new PHP project that uses ODBC. What is the correct way to escape user input in a SQL string? Is addslashes() sufficient? I would like to get this right now rather than later! 回答1: Instead of string escaping the PHP ODBC driver uses prepared statements. Use odbc_prepare to prepare an SQL statement and odbc_execute to pass in the parameters and execute the statements. (This is similar to what you can do with

FreeTDS working, but ODBC cannot connect

99封情书 提交于 2019-11-27 23:05:12
问题 I am trying to run connect to a MSSQL server from an Ubuntu 12.04 webserver with FreeTDS and unixODBC. Using tsql i can connect to the server with ~$ tsql -S dbs3 -U <username> -P <password> No problem there. When I try to connect with isql however, I get the following error message: ~$ isql -v database3 <username> <password> [S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source [01000][unixODBC][FreeTDS][SQL Server]Unknown host machine name. [ISQL]ERROR: Could not SQLConnect

'PDOException' with message 'SQLSTATE[22001]: String data, right truncated: 0

久未见 提交于 2019-11-27 22:45:01
NOTE: I have narrowed this problem down to specifically PDO because I am able to successfully prepare and execute statements using the odbc_* functions. Why can't I bind this parameter to the PDO prepared statement? This works: $mssqldriver = 'ODBC Driver 13 for SQL Server'; $pdoDB = new PDO("odbc:Driver=$mssqldriver;Server=$hostname;Database=$dbname", $username, $password); $pdoDB->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $sql = "SELECT 'value' AS col where 'this' = 'this'"; $stmt = $pdoDB->prepare($sql); $params = []; $stmt->execute($params); print_r($stmt->fetch()); Array

ODBC prepared statements in PHP

巧了我就是萌 提交于 2019-11-27 21:20:55
I'm trying to use odbc_prepare and odbc_execute in PHP as follows: $pstmt=odbc_prepare($odb_con,"select * from configured where param_name='?'"); $res=odbc_execute($pstmt,array('version')); var_dump($res); //bool(true) $row = odbc_fetch_array($pstmt); var_dump($row); //bool(false) The first var_dump returns true so the execute succeeds, but there is no row returned. A row does indeed exist with the param_name = 'version'. Why is no row returned? To make things interesting, I ran another very simple example in php using a prepared insert. $pstmt=odbc_prepare($odb_con,"insert into tmp1 values(?,

How to connect java to Ms Access 2010?

好久不见. 提交于 2019-11-27 19:54:32
Does anyone have any ideas of how to connect Access 2010 to java jdbc. I use this method, but when I call it, it doesn't work: public void loadDb(){ try{ Class.forName("sun.jdbc.JdbcOdbcDriver"); File f = new File(System.getProperty("user.dir")) con = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Acess Driver (*.mdb, *.accdb)}; DBQ="+ f.getPath() + "//db//JavaAccess.accd","",""); st = con. createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); }catch(ClassNotFoundException e){e.printStackTrace(); }catch(SQLException e){e.printStackTrace();} } //con and st are

RODBC queries returning zero rows

依然范特西╮ 提交于 2019-11-27 19:46:53
Issue: RODBC (falsely) returning zero rows Situation: I'm using RODBC to connect to a DSN I created using a commercial DB's ODBC driver (OSI Soft's PI Historian Time Series DB, if you're curious). > library(RODBC) > piconn <- odbcConnect("PIRV", uid = "pidemo") > sqlStr <- "SELECT tag, time, status, value FROM piinterp WHERE tag = 'PW1.PLANT1.PRODUCTION_RATE' and time > DATE('-4h') and timestep = '+2m'" Now if I query, I get zero rows. > sqlQuery(piconn, sqlStr) [1] TAG TIME STATUS VALUE <0 rows> (or 0-length row.names) With BelieveNRows = FALSE these all still show zero results, even though

In SQLAlchemy, can I create an Engine from an existing ODBC connection?

落花浮王杯 提交于 2019-11-27 19:12:38
问题 I am working in an environment where I am given an ODBC connection, which has been created using credentials to which I don't have access (for security reasons). However I would like to access the underlying database using SQLAlchemy - so my question is, can I pass this ODBC connection to something like create_engine, or alternatively, wrap it in such a way that it looks like a SQLAlchemy connection? As a supplementary question (and working on the optimistic assumption that the first part can