odbc

PDO does not throw exception with multiple queries

自闭症网瘾萝莉.ら 提交于 2019-11-29 11:44:20
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 bad, then it just swallows the error and all appears fine. But looking at the database afterwards

How do I connect to an MS Access database using Perl?

走远了吗. 提交于 2019-11-29 11:27:36
I have a .accdb file on my local machine and I am trying to connect to it and read some data from 3 tables within the DB. How do I establish the connection using Perl? So far I have scraped together this much for MS Access, but I am getting errors saying that I am not using the correct driver. Any ideas? my $msaccess_dbh = DBI->connect( 'dbi:ODBC:driver=microsoft access driver (*.accdb);' . 'dbq=C:\path\to\database\databasefile.accdb' ); Thanks! EDIT: Just to clarify, I have no real requirements here. I just need to do 2 or 3 selections from this MS Access DB, and then I will be done with it.

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

梦想的初衷 提交于 2019-11-29 11:10:13
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 Server]String data, right truncation (SQLExecute[0] at /builddir/build/BUILD/php-5.3.3/ext/pdo_odbc/odbc

Prepared statement cannot be executed multiple times with integer values

这一生的挚爱 提交于 2019-11-29 10:59:38
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_EXCEPTION ); $values = ['here','are','some','values']; $sql = "INSERT INTO mytab (something) VALUES (

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

拜拜、爱过 提交于 2019-11-29 10:46:57
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 using this as the connection string for the MS SQL db: $dbConn = new PDO("odbc:Driver=FreeTDS;DSN=OURDSN

Listing ODBC Data Sources in C#

人盡茶涼 提交于 2019-11-29 09:36:07
I'm looking for a properly abstract way to get a list of ODBC data sources from the system in C#. I've tried the "Poking-around-in-the-registry" trick, which I've found works fine in English: RegistryKey reg = (Registry.CurrentUser).OpenSubKey("Software"); reg = reg.OpenSubKey("ODBC"); reg = reg.OpenSubKey("ODBC.INI"); reg = reg.OpenSubKey("ODBC Data Sources"); and then, of course, iterating over reg.GetValueNames() Only problem is that I've discovered on at least one Spanish machine that their Registry keys are, well, in Spanish, so clearly violating this abstraction (if it exists) has

does anyone know the format of an odbc connection string for vertica?

筅森魡賤 提交于 2019-11-29 09:03:21
问题 I'm using the following: DRIVER={Vertica ODBC Driver 4.1}; SERVER=lnxtabdb01.xxxx.com; PORT=5433; DATABASE=vertica; USER=dbadmin; PASSWORD=vertica; OPTION=3; i'm getting this error and I just wanted to make sure that my connection string was cool before I check other possible issues. error: EnvironmentError: System.Data.Odbc.OdbcException (0x80131937): ERROR [28000] FATAL: no Vertica user name specified in startup packet UPDATE: For now i'm just using a System Data Source Name in Windows

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

谁都会走 提交于 2019-11-29 08:27:08
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(2048) > x <- charToRaw("catch@123") > e <- PKI.encrypt(x, key) > y <- PKI.decrypt(e, key) > stopifnot

How can I add a password to this JDBC:ODBC connection string that is trying to connect to an MS Access database

时光总嘲笑我的痴心妄想 提交于 2019-11-29 08:24:31
This is the connection string that is currently working on a non-password protected MS Access database. this code snippet is from our properity file: db.url = jdbc:odbc:Driver\={Microsoft Access Driver (*.mdb)};Dbq\=C:\Inventory.mdb;DriverID\=22;READONLY\=true How do I add a password to this connection string for a MS Access DB protected by a database password ( Non-ULS )? Thanks! Referenced from here: Java Support db.url = jdbc:odbc:Driver\={Microsoft Access Driver (*.mdb)}Dbq\=C:\Inventory.mdb;DriverID\=22;READONLY\=true; UID\=me;PWD\=secret Ganesh To work on password protected MS Access

How to check if a table exists in Hive?

两盒软妹~` 提交于 2019-11-29 08:00:06
问题 I am connecting to Hive via an ODBC driver from a .NET application. Is there a query to determine if a table already exists? For example, in MSSQL you can query the INFORMATION_SCHEMA table and in Netezza you can query the _v_table table. Any assistance would be appreciated. 回答1: There are two approaches by which you can check that: 1.) As @dimamah suggested, just to add one point here, for this approach you need to 1.1) start the **hiveserver** before running the query 1.2) you have to run