odbc

Need a row count after SELECT statement: what's the optimal SQL approach?

为君一笑 提交于 2019-11-26 22:45:10
问题 I'm trying to select a column from a single table (no joins) and I need the count of the number of rows, ideally before I begin retrieving the rows. I have come to two approaches that provide the information I need. Approach 1: SELECT COUNT( my_table.my_col ) AS row_count FROM my_table WHERE my_table.foo = 'bar' Then SELECT my_table.my_col FROM my_table WHERE my_table.foo = 'bar' Or Approach 2 SELECT my_table.my_col, ( SELECT COUNT ( my_table.my_col ) FROM my_table WHERE my_table.foo = 'bar'

CodeIgniter MSSQL connection

戏子无情 提交于 2019-11-26 22:42:48
I'm working on a web project that is to be deployed on a 64bit Windows 2008 Server machine running IIS 7.5 and PHP 5.3.8. The database on the system is Microsoft SQL Server 2008 R2. I'm developing the application on the CodeIgniter 2.1.0 framework, and I'm a bit stumped on getting it to connect to the SQL Server. I've tried using both the MSSQL, ODBC and SQLSRV database drivers, and have encountered three separate errors, for each different driver. Here is my configuration for ODBC: $db['default']['hostname'] = 'SA'; $db['default']['username'] = 'petre'; $db['default']['password'] = 'start';

Excel: Use a cell value as a parameter for a SQL query

大憨熊 提交于 2019-11-26 21:56:13
I'm using MS Excel to get data from a MySQL database through ODBC. I successfully get data using an SQL query. But now I want that query to be parameterized. So I wonder If it is possible to use a cell value (a spreadsheet cell) as a parameter for such a query. For example, for this query: select name from user where id=1 I'd like to get the id value from, say, cell D4 in the spreadsheet. Is that the proper approach to parameterize a query? and how can I do it? Thanks. Joaquim I had the same problem as you, Noboby can understand me, But I solved it in this way. SELECT NAME, TELEFONE, DATA FROM

How to bind parameters via ODBC C#?

ⅰ亾dé卋堺 提交于 2019-11-26 20:55:20
I need to bind parameters on ODBC query from C#. This is the sample code, but VS tells me that there's one parameter missing. OdbcCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT * FROM user WHERE id = @id"; cmd.Parameters.Add("@id", OdbcType.Int).Value = 4; OdbcDataReader reader = cmd.ExecuteReader(); What is the syntax for binding values on ODBC? Odbc cannot use named parameters. This means that the command string uses placeholders for every parameter and this placeholder is a single question mark, not the parameter name. OdbcCommand.Parameters Then you need to add the

sql.h header file missing though unixODBC is installed

我是研究僧i 提交于 2019-11-26 20:53:14
问题 I am on an up-to-date Ubuntu 12.04 system. I have unixodbc (v2.2.14 from ubuntu repos), MySQL and its relevant drivers installed. Also connected to a valid DSN. Verified by issuing isql DBName UName passwd . I am trying to compile a C application that interacts with the database using ODBC. Almost everywhere I searched seemed to indicate that I should have "sql.h" installed somewhere. A find / -iname sql.h -print showed I don't have it. So my question is: where is it? Did something go wrong

Hand Install of 64-bit MS Access ODBC drivers when 32-bit Office is present

女生的网名这么多〃 提交于 2019-11-26 20:26:50
I want to do a hand install of the MS Access 64 bit odbc drivers. Uninstalling 32 bit Office and installing 64 bit Office is not an option due to the add-ins that our company uses. I downloaded the AccessDatabaseEngine_x64.exe and using WinRar and Universal Extractor have managed to unpack all the files into a temp directory. I believe I have all of the files necessary but am a bit unsure where to go from here and would appreciate a little guidance. Which DLLs need to be registered to make the MS Access ODBC drivers available in the 64 bit ODBC administrator? Is there a list of registry

Creating a custom ODBC driver

做~自己de王妃 提交于 2019-11-26 20:06:40
问题 At my current job, we're looking to implement our own odbc driver to allow many different applications to be able to connect to our own app as a datasource. Right now we are trying to weigh the options of developing our own driver to the implementation spec, which is massive, or using an SDK that allows for programmers to 'fill in' the data specific parts and allow higher levels of abstraction. Has anyone else implemented a custom odbc driver? What pitfalls did you run into? What benefits did

How to connect java to Ms Access 2010?

依然范特西╮ 提交于 2019-11-26 20:01:38
问题 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

RODBC queries returning zero rows

拥有回忆 提交于 2019-11-26 19:59:27
问题 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

Unable to retrieve UTF-8 accented characters from Access via PDO_ODBC

◇◆丶佛笑我妖孽 提交于 2019-11-26 19:09:42
I am trying to get an Access DB converted into MySQL. Everything works perfectly, expect for one big monkey wrench... If the access db has any non standard characters, it wont work. My query will tell me: Incorrect string value: '\xE9d' If I directly echo out the rows text that has the 'invalid' character I get a question mark in a black square in my browser (so é would turn into that invalid symbal on echo). NOTE: That same from will accept, save and display the "é" fine in a textbox that is used to title this db upload. Also if I 'save as' the page and re-open it up the 'é' is displayed