odbc

PDO does not throw exception with multiple queries

只谈情不闲聊 提交于 2019-11-28 05:29:16
问题 How can I get PDO to throw an exception when executing multiple queries? If I run the erroneous sql by itself: $execute($ddl_partial); $execute($insert); Then I get the expected error: PHP Fatal error: Uncaught PDOException: SQLSTATE[42S22]: Column not found: 207 [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Invalid column name 'other'. (SQLExecute[207] at /build/php7.0-41GaEn/php7.0-7.0.8/ext/pdo_odbc/odbc_stmt.c:260) However, if I run some good SQL first and follow it up with the

I'm getting “String data, right truncation” errors from PHP using ODBC and connecting to a Microsoft SQL Server 2008R2 instance

寵の児 提交于 2019-11-28 04:40:41
问题 I am using PHP 5.3.3 on a CentOS 6.2 box, connecting to an instance of Microsoft SQL Server 2008R2. The connection works, and I am able to retrieve data, so long as my queries contain no parameters. When I add parameters, I get the error, "String data, right truncation". Here's some example code: <?php $dbh = new PDO("odbc:myDSN", 'myUsername', 'myPassword'); $testCase = 1; switch ($testCase) { case 1: // This case fails with this error: // Error 22001: [Microsoft][ODBC Driver 11 for SQL

OLEDB v/s ODBC [duplicate]

一世执手 提交于 2019-11-28 04:34:39
This question already has an answer here: what is the difference between OLE DB and ODBC data sources? 11 answers What is the difference between OLEDB and ODBC? When do I use which and how do I know what I am looking at is a OLEDB driver v/s an ODBC driver? OLEDB and ODBC are two different database API's. ODBC is an older standard and is actually not specific to windows - you can get Unix-based ODBC libraries. OLEDB is a COM-based API for database connections. There is a driver for wrapping ODBC with an OLEDB front-end if the database you are using does not come with a native OLEDB driver.

ODBC query on MS SQL Server returning first 255 characters only in PHP PDO (FreeTDS)

北城余情 提交于 2019-11-28 04:16:46
问题 I'm currently trying to pull some data from a SQL Server database view that we have restricted access to from our Linux web server. We don't need to edit the data just display it in a webpage. It all looks fine until we try to output and only get the first 255 characters of a text field. Does anyone know if this is a problem with using FreeTDS through PHP::PDO or if it should work fine? I've seen other people out there having similar problems, but there don't seem to be many answers. I'm

Prepared statement cannot be executed multiple times with integer values

試著忘記壹切 提交于 2019-11-28 04:07:56
问题 How do I properly re-execute a prepared statement using different integer values? There's something deathly wrong with explicit and implicit binding PDO::PARAM_INT when reusing an ODBC prepared statement. CREATE TABLE mytab ( col INT, something VARCHAR(20) ); Works : multiple strings $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

Specify and use multiple libraries in ODBC connection string

不羁岁月 提交于 2019-11-28 02:05:52
问题 My odbc connection string for connecting to DB2i looks like this: Driver={Client Access ODBC Driver (32-bit)};system=xx.xx.xx.xx;dbq=LIB1 LIB2 LIB3 LIB4 LIB5 LIB6 LIB7 LIB8;languageid=ENU;qrystglmt=-1;cmt=0;signon=1 The above connection string specifies multiple libraries/schemas for use. But when I try to access a file/table from a library other than the first one (like from LIB2...LIB8) I get a exception saying "FILE xx not found in LIB1" Why does not it automatically search for the file

ODBC export to Excel fails under Windows 7, Windows 8.x and Windows 10

无人久伴 提交于 2019-11-28 02:04:44
I just created some code (at the bottom) from scratch that shows a simple Excel export. The code fails with an exception when database.OpenEx is called. The exception shown is: Reservierter Fehler (-5016); es gibt keine Meldung für diesen Fehler. Ungültiges Attribut für die Verbindungszeichenfolge. CREATE_DB Ungültiges Attribut für die Verbindungszeichenfolge. CREATE_DB Ungültiges Attribut für die Verbindungszeichenfolge. CREATE_DB Ungültiges Attribut für die Verbindungszeichenfolge. CREATE_DB Allgemeine Warnung Registrierungsschlüssel 'Temporary (volatile) Jet DSN for process 0x844 Thread

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

谁说我不能喝 提交于 2019-11-28 01:58:39
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 be satisfied) is there a way that I can tell SQLA what dialect to use for the underlying RDBMS? Thanks

Encrypt password in R - to connect to an Oracle DB using RODBC

只愿长相守 提交于 2019-11-28 01:55:37
问题 I use the following code to connect Oracle database: > library(RODBC) > channel <- odbcConnect("R", uid="xxx", pwd="catch@123") > sqlSave(channel ,resultsclassifiedfinal_MC_TC_P1, tablename="table1", rownames=FALSE, append=TRUE, fast = FALSE, nastring = NULL) > odbcClose(channel) However, I cannot use a cleartext password in public. I want to encrypt the password. I see a pki and digest library to use, is this a way to do it? Update I tried below code : > require(PKI) > key <- PKI.genRSAkey

Delphi ODBC Connection Dialog Component?

谁说胖子不能爱 提交于 2019-11-28 01:34:47
问题 I am thinking about adding ODBC database connectivity to an application. The user will at runtime configure and select their database odbc connection. Are there any components that will give me the required series of dialogs ? Allowing the user to select the data source type, select drivers, browse already defined ODBC connections etc. Cheers Sam 回答1: You can try this, if you are using ADO components. Option 1 Uses OleDB, ComObj, ActiveX; function Edit_ADO_ODBC_ConnectionString(ParentHandle: