As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [dbi]

DBI is a database access module for the Perl programming language. It defines a set of methods, variables, and conventions that provide a consistent database interface, independent of the actual database being used. For the equivalent R package, use the tag r-dbi.

Filter by
Sorted by
Tagged with
1 vote
1 answer
63 views

How to draw database structure with Perl?

I know that is possible to load database structure and automatically create Result/*.pm files for usage with DBIx::Class. Also I know that it is possible to draw an image of all tables at this ...
Eugen Konkov's user avatar
  • 21.6k
0 votes
0 answers
29 views

Load date from R date frame into Oracle database

I am writing a data.frame through odbc into oracle database. The oracle table consist of 2 columns - Date_Updated and Count_type (varchar). When I execute the dbWriteTable, it gives me a conversion ...
Neel's user avatar
  • 27
-2 votes
0 answers
62 views

ODBC driver fetching different precision values than displayed in Sql server management studio UI

I have a perl script which I is connecting to a sql server database using ODBC driver like so DBI->connect("DBI:ODBC:Driver={ODBC Driver 17 for SQL Server};server=$server,$port";, $usernm,...
Amruta's user avatar
  • 1,191
0 votes
1 answer
84 views

Problem with share_cloned on Perl dbh objects

I'm trying to test the ConnectionPool concept for Perl. Basically the test is to have a shared array that holds pre-existing $dbh instances so that individual threads can just re-use them without ...
santa100's user avatar
  • 255
0 votes
1 answer
35 views

SQL filtering multiple columns based on various values (performed in R (dbi/odbc))

I am working with an SQL script in the R environment, using packages ODBC/DBI to connect to the server: original_file <- DBI::dbConnect(odbc::odbc(), Driver = "DenodoODBC ...
R_coder_new's user avatar
1 vote
1 answer
71 views

How to pass perl $dbh objects between scripts

I have to maintain some Perl CGI scripts in our production codebase. The problem is that when the CGI job runs, it takes some time to instantiate the Perl DB's $dbh object before it could be used to ...
santa100's user avatar
  • 255
-1 votes
2 answers
76 views

Missing table in PostgreSQL database

I was able to connect to the database, write the table, read it, but the dbGetQuery command gives an error Error: Failed to prepare query: ERROR: relation "table" does not exist LINE 1: ...
KOs's user avatar
  • 1
0 votes
0 answers
31 views

Problems installing older versions of odbc in R

I'm trying to troubleshoot why my colleague can pull down 1.6M rows of data from a Snowflake table using odbc in less than 1 min whereas it take over an hour for me to do the same. The only difference ...
TheGoat's user avatar
  • 2,525
1 vote
1 answer
128 views

How to run a 'INSERT INTO SELECT" with 2 databases in Perl?

Since each mysql statement in Perl is linked to its connection handler : my $handlerDB1 = DBI->connect(etc ...); my $handlerDB2 = DBI->connect(etc ...); I wonder if there's a trick to do a ...
troubadour's user avatar
1 vote
0 answers
94 views

Loading and/or attaching `package:DBI` and `package:odbc` et al.?

I found no explicit guidance in DBI documentation on how to load the front-end (i.e. package:DBI) and the back-end (e.g. package:odbc). Most examples in the documentation (but not all) attach package:...
Thomas's user avatar
  • 447
1 vote
1 answer
87 views

DB2: should I decode fetched data with utf8, regardless of the database code set?

Is utf-8 the correct encoding for decoding data retrieved from a DB2 database, regardless of the database's code set? #!/usr/bin/env perl use strict; use warnings; use DBI; my ( $db, $dbh, $sth, $...
sid_com's user avatar
  • 24k
0 votes
0 answers
10 views

i have some enroll with: Foreign key 'FK__GiangVien__makho__38996AB5' references invalid table 'Khoa'

CREATE TABLE GiangVien ( magv int PRIMARY KEY, hotengv char(30), luong decimal(5,2) CHECK (luong >= 0), makhoa char(10), FOREIGN KEY (makhoa) REFERENCES Khoa(makhoa) ); CREATE ...
anhdzung's user avatar
0 votes
0 answers
26 views

dbWriteTable to mysql with default and null as specified for each field

I am trying to write a table from R to mySQL using dbWriteTable. I would also like to specify that the certain fieldtypes cannot be null and a default value for those specific fieldtypes. I am ...
Shryans Baid's user avatar
3 votes
0 answers
66 views

DBI: are schema and table-name enough for a qualified table name?

Are there cases where a qualified table name consisting of schema and table-name, is not sufficient if the connection was made with the DBI connect method? Not sufficient in the sense that the catalog ...
sid_com's user avatar
  • 24k
0 votes
0 answers
35 views

cannot upload tweets with emojis to mysql database using RMariaDB

Original Post I am trying to gather some tweets using the {rtweet} package and store them in a MySQL database. But I am getting errors whenever I try to upload a tweet that contains emojis. Here is my ...
Wahiduzzaman Khan's user avatar
0 votes
2 answers
82 views

Get the results sets of a parametrized query `rbind`ed *and* directly in the database using R's `DBI`

Using package:DBI, I need to: run a parametrized query with different parameters (i.e. a vector of parameters); get the results sets concatenated (i.e. rbinded as per R terminology or unioned as per ...
Thomas's user avatar
  • 447
0 votes
1 answer
63 views

How to vacuum an sqlite database within R?

I have created and filled a sqlite database within R using packages DBI and RSQLite. E.g. like that: con_sqlite <- DBI::dbConnect(RSQLite::SQLite(), "../mydatabase.sqlite") DBI::...
panuffel's user avatar
  • 611
0 votes
0 answers
75 views

Strawberry Perl and TLS 1.2 connection error with DBD::mysql

My company currently relies on ActivePerl for windows implementations, but are trying out Strawberry Perl. The only real problem we have hit is accessing MySQL when TLS 1.2 is required. We get the ...
Brinson Tatum's user avatar
0 votes
1 answer
39 views

Automatically strip trailing whitespace when fetching data with `DBI::dbGetQuery()` in R?

I work with a database (of which I am not the DBA) that has character columns of length greater than the actual data. Is it possible to automatically strip trailing whitespace when fetching data with ...
Thomas's user avatar
  • 447
3 votes
1 answer
79 views

How do I handle Unicode with DBD::Oracle?

The perl DBI documentation says this : Perl supports two kinds of strings: Unicode (utf8 internally) and non-Unicode (defaults to iso-8859-1 if forced to assume an encoding). Drivers should accept ...
dami's user avatar
  • 136
0 votes
1 answer
35 views

multi row data frame as bound parameters in `package:ROracle` SELECT statements

I am trying to use a parametrized query multiple times with package:ROracle. library(DBI) conn <- dbConnect(ROracle::Oracle(), ...) statement <- "select * from bigtable where name = :1&...
Thomas's user avatar
  • 447
0 votes
1 answer
75 views

Which DBI function for statements like `create table <tabX> as select * from <tabY>` in R?

I am using package:DBI/package:ROracle. conn <- dbConnect(ROracle::Oracle(), ...) I need to create a table from a select query in another table (i.e. a statement like create table <tabX> as ...
Thomas's user avatar
  • 447
-3 votes
1 answer
199 views

Can't write an SQLite Query

Using the file posts.csv in the data folder of this repo (the sample of 10,000 public Facebook posts by members of the US congress from 2017), solve the following with dplyr: Do not consider posts ...
Jay's user avatar
  • 19
0 votes
1 answer
107 views

Connection to oracle database (odbc): invalid username/password; logon denied

I would like to connect to an oracle database using the R package odbc. The following gives an error: host <- 'something' port <- 1523 svc <- "this" pass <- '***' user <- 'me' ...
Wave's user avatar
  • 1,216
0 votes
0 answers
111 views

R - bigrquery::bq_auth() function does not work - I can not reauthenticate to connect with BigQuery

First things first: Operating System: Windows 10 R version: 4.2.2 Story I am trying to import data from Google BigQuery to R. I am using bigrquery package. However any operations after creating DBI ...
Adrian Gasiński's user avatar
2 votes
2 answers
89 views

What happens if I assign two DBI connections in a row to a variable?

What happens to the first connection if I assign two DBI connections in a row to a variable? It doesn't feel like there is an implicit disconnect (no lag). my $dbh = DBI->connect( $dsn, $user, $...
sid_com's user avatar
  • 24k
1 vote
3 answers
68 views

DBD::DB2: why does a `$dbh->disconnect` cause gaps in an autoincrement column?

Why does the $dbh->disconnect cause gaps in the auto-increment column? use DBI; my $db = 'MYDB2'; my $table = 'SCHEMA.TABLE'; my $user = 'user'; my $pass = 'passwd'; my $dsn = "dbi:DB2:$db&...
sid_com's user avatar
  • 24k
2 votes
2 answers
66 views

Array of Hashrefs: How to access based on hashref "column" values

I have an array of hashrefs built from a database using fethrow_hashref(). The data structure is built like so: while (my $ref = $sth->fetchrow_hashref()) { push @lines, $ref; } I sort the ...
WetCheerios's user avatar
2 votes
1 answer
371 views

DB2 ODBC connection doesn't work on R 4.2

I had a working connection to a DB2 server from R. Then I ungraded to R v4.2 and it no longer works. This is my connection string: con_DB2 = DBI::dbConnect(odbc::odbc(), ...
FG120's user avatar
  • 61
0 votes
0 answers
35 views

Flexdashboard: Storyboard does not work with ODBC and temporal environment variables

I am using flexdashboard (0.5.2), ODBC (1.3.3) in R 4.1.0 and IDE RStudio (2021.09.2) on a Server (not in my local machine) I have being building flexdashboard storyboards and I wanted to "level ...
Corina Roca's user avatar
0 votes
2 answers
845 views

Can't open lib 'ODBC Driver 18 for SQL Server' in R on MacOS (CPU M2)

On a MacOS Ventura with a Apple Silicon M2 CPU, I have installed the Microsoft ODBC driver 18 for SQL Server following the instructions provided by Microsoft at: https://learn.microsoft.com/en-us/sql/...
Jochem's user avatar
  • 3,243
0 votes
1 answer
33 views

Querying/importing millions of rows in R from MySQL

I am having performance issues. I have an indexed table of 3 millions rows, which will eventually get to 15 millions in MySQL. When I run a simple query from R through dbi/RMySQL Select * from sales ...
Maad scientist's user avatar
0 votes
0 answers
33 views

Why does the pin count only three blocks in trace?

I want to list all traces with the blocks they contain, using intel pin. But, as a result, I have a maximum of three blocks in the trace, although there should be more. Tell me, please, why is that so?...
Artorios's user avatar
0 votes
0 answers
177 views

SYNTAX_ERROR: line 1:1: Incorrect number of parameters: expected 1 but found 0 for parameterized SQL in R

I have an SQL query that I am trying to parameterize. It looks something like this: query = "SELECT * FROM pie_table AS p WHERE p.name = ?;" This is not the exact query ...
Nick's user avatar
  • 359
1 vote
0 answers
44 views

Create a DBI bind param surrounded by " and not '

I am using MySQL to access SphinxQL, so not a normal mysql setup. I am trying to safely insert text into a bind parameter into my query (so I can safely insert anywhere into the string). I am ...
Ian's user avatar
  • 13.7k
0 votes
1 answer
39 views

R dbWriteTable to Cloud Spanner requiring column names

I'm trying to insert data into a Cloud Spanner table using DBI's dbWriteTable in R, however, it is asking me to supply column names. It is my understanding that as long as the dataframe contains the ...
Tomek's user avatar
  • 1
1 vote
1 answer
27 views

Row Binding Separate Database Queries

I'm working with two similar sets of data in a database. I've been querying them using dplyr syntax (e.g., q1 <- tbl(con, "data") q2 <- tbl(con, "data2")) , but I can't find ...
NoCaresBear's user avatar
0 votes
0 answers
74 views

odbc causes Rscript.exe to crash - R for windows front-end has stopped working

For several years I have use the system function to run an R script via Rscript.exe, in order to load MS Access tables from within a 64-bit R window (RODBC works only with 32-bit, apparently). ...
Glenn Stauffer's user avatar
0 votes
0 answers
88 views

How to Retrieve/Save a BLOB from MySQL Database using R?

I have implemented a R Shiny application in which I upload successfully a xgb.model binary file into MySQL Database and after that I would also like to retrieve/save it in the local storage in order ...
MariosCh1's user avatar
0 votes
1 answer
72 views

MariaDB: How to execute Perl-script from sql-script?

Is it possible to execute a Perl-script from a SQL-script? For example: ALTER table ADD extract TEXT DEFAULT NULL; CALL(perl-script) -- will update table extract (continue with sql) My intention ...
giordano's user avatar
  • 2,914
2 votes
1 answer
108 views

execute failed: Incorrect string value: '\xE4rvine...' with mariadb and perl DBD

More than three years ago I posted a similar question related to not being able to insert data into a table because of what I believe is an incorrect character set, and I'm having the same problem ...
Alex Regan's user avatar
0 votes
0 answers
47 views

dbExistsTable does not find temporary table created via copy_to

Regardless of which variant I try, dbExistsTable will always return FALSE. So how would I check if a temporary table does already exist? library(DBI) library(dbplyr) con <- dbConnect(odbc::odbc(), &...
thothal's user avatar
  • 16.1k
1 vote
0 answers
552 views

Unable to access tables written to duckdb when starting new R session (but .duckdb file is not empty)

I am having trouble with Duckdb (through R) since I have changed computer and reinstalled all of my software. I have a local duckdb connection through which I am writing datasets (with DBI). For ...
rmathers's user avatar
1 vote
1 answer
267 views

R DBI connection closed unexpectedly by server + server terminated abnormally before or while processing request

I am using DBI and pqdriver for Postgres via RPostgres::Postgres() to establish a connection like the following. con <- DBI::dbConnect(RPostgres::Postgres(), dbname = "my_db", host = &...
info_seekeR's user avatar
  • 1,296
0 votes
1 answer
230 views

How to have the correct char encoding using information from a external database?

In my database i have this value in a field of a table CIÓN an accent in vowel "O", when i get information from the table into R through a connection DBI, the character is displayed ...
hfa's user avatar
  • 39
0 votes
0 answers
32 views

How to these use R libraries to write and save a 'some_content' string into a field of an existing SQL table object?

How to these use R libraries to write and save a 'some_content' string into a field of an existing SQL table object? I want to insert a 'some_content' string into the field barplot inside the ...
Joao Henrique da Silva's user avatar
0 votes
2 answers
203 views

Retrieve a specific DB project and its tables from SQL Server in R

I am new to using SQL Server from RStudio. I am connected to SQL Server from RStudio and the server has several different projects listed in the below image. For this work I am using odbc library. I ...
Usman YousafZai's user avatar
2 votes
1 answer
211 views

Properly quoting SQL query with " and ' in R

I need to submit the following query through my R code: select t."date" from db.table t where t."date" > '2016-01-01'; To generate this quoted string properly, I tried: ...
Fabio Correa's user avatar
  • 1,237
1 vote
0 answers
233 views

R and RStudio crashing when using DBI

I have a PostgreSQL database on my machine that I routinely connect to through R. I have had no issues reading, writing, or appending data to the database in the past. Recently I upgraded to R 4.2.1 ...
BillPetti's user avatar
  • 511
0 votes
0 answers
236 views

Optimising query performance using R, odbc and Microsoft SQL Server

I'm looking to collect about 300K rows of data from my SQL Server. My query runs in approx. 20 seconds using DBeaver (uses a JDBC driver) Vs. my query from R using DBI/odbc which takes more than 15 ...
TheGoat's user avatar
  • 2,525

1
2 3 4 5
28