Error connecting MS-Access database from PHP (DSN-less) Windows - odbc

I has reinstalled Windows 7 (64-bit) including PHP and Apache Server (Using WAMP SERVER). I had a code running ok in the previous instalation (I do not know which version of php and apache did) but now is not working.
When I run it appears a warning without information and it does not conect: Warning: odbc_connect ()
I have more than three days trying to solve the problem but I can not found the solution, any ideas?
The current versions are:
Windows 7 64bit
PHP 5.4.3
Apache 2.4.2
The code is:
$db = 'D:\database.mdb';
$dsn = "Driver={Microsoft Access Driver (*.mdb)}; charset=UTF-8;Dbq=$db";
$conn = odbc_connect( $dsn, '', '' );
Thank you!
Javier.

I don't know the problem solution but I has uninstalled WAMP Server and I has installed XAMP Server and it works again! – jakama just now edit

Related

github actions 'SSL connect error' on R package check on ubuntu but not macOS or windows

I'm hitting an SSL error in a ubuntu session of GitHub actions that I'm not sure I understand. these are the three lines of R code in the GitHub action that works on windows and macOS but fail on Ubuntu:
tf <- tempfile()
this_url <- "https://webfs.oecd.org/piaac/puf-data/SAS/SAS7BDAT/prgusap1_2012.sas7bdat"
download.file( this_url , tf , mode = 'wb' )
You can see the windows/macOS successes and ubuntu failures at: https://github.com/asdfree/piaac/actions/runs/4130891484
From what I've found elsewhere, it looks like I need to use OpenSSL on the Linux runner of the GitHub Actions.
I found some examples of how to use OpenSSL within an r.yml file here: https://github.com/jeroen/testbug/blob/929151a0f19ed029d0ae34a7b3661d453974de53/.github/workflows/test.yaml
But my attempt to modify the r.yml file didn't seem to solve the issue: https://github.com/asdfree/piaac/commit/9eb93f8ac8c2eae61300364337b6a357ba56d9e7
i've also attempted three alternatives to download.file() -- ubuntu still fails where windows and macOS succeeds. the error here shows up as unsafe legacy renegotiation disabled even when i use ssl.verifypeer=FALSE
https://github.com/asdfree/piaac/commit/07cb4808a4d027f28d6e8cefdf5af09493dcb309
https://github.com/asdfree/piaac/actions/runs/4131647361
https://github.com/asdfree/piaac/commit/468588f6813cfe734d7b11b875070b331189cbc0
https://github.com/asdfree/piaac/actions/runs/4131695976
https://github.com/asdfree/piaac/commit/77e228ef72fc3a781dba51c23ceb9f54f0fac286
https://github.com/asdfree/piaac/actions/runs/4131784227
Any advice about how to work around this issue would be appreciated. Thanks!

New install of 19c with 11g client; ORA-12560 error

On a new Windows Server 2016 PC:
signed on as administrator
Fresh install of 19c with default orcl database. No issues during install
Installed full 32-bit 11g client (needed for connection to legacy app) no install issues
added SQLNET.ALLOWED_LOGON_VERSION_SERVER = 11 to sqlnet.ora
tnsping orcl ran and showed connection
sqlplus /nolog
connect / as sysadm
returned ORA-12560 TNS Adapter: protocol adapter error
Both listener and orcl services are running (tried restarting them but still got error)
Tried setting $TNS_ADMIN and $ORACLE_HOME but error still occurs.
Tried rebooting but no change.
PATH has client oci.dll folder listed first then ORACLE HOME folder
Pulling hair out has commenced...
I'm new to Oracle database, but I had a similar problem while installing Oracle 21DB express. I kept installing and uninstalling because I could not get past the login/password. It kept giving me
"ORA-12560 TNS Adapter: protocol adapter error"
what I finally did was on my last installation, on the setup.exe, you must right click on the mouse and "run as administrator". Then everything ran perfectly. Also while researching I was told don't have more than 1 version of SQL on a machine.

xampp v3.2.4 enabling sqlite3 (WINDOWS 10) 64bit

I've setup xampp on my windows machine, and I'm trying to use the sqlite3 module with php 7.4.3
I've edited my php.ini file and adjusted the extension=sqlite3 and restarted the service.
When i try and run this:
<?php
$db = new SQLite3('test.db');
?>
I get this error:
Fatal error: Uncaught Error: Class 'SQLite3' not found
I've also tried using pdo:
$db = new PDO("sqlite:".__DIR__."/test.db");
And with that i get this error instead:
Fatal error: Uncaught PDOException: could not find driver
Now I'm sure i have the sqlite3 ext because when i check the php/ext folder i can see the php_sqlite3.dll
I haven't changed anything else in the php.ini regarding the dir for the ext but im sure it's all setup correctly since all the other extensions are working just fine. Maybe I'm just being ignorant and I'm using sqlite3 incorrectly so please if someone knows the problem enlighten me.
Go in your XAMPP\php\php.ini, modify it with a text editor
Search for ;extension=sqlite3 with CTRL + F
Remove the ; to uncomment the line
Restart Apache to apply change
Now you are able to use Sqlite3 on XAMPP for Windows :D
Uncomment extension=sqlite3 in php.ini:
;extension=sqlite3
=>
extension=sqlite3
and restart Apache.
libsqlite3.dll isn't installed in the xampp\apache\bin folder.
you have to go into xampp\php copy libsqlite3.dll and paste into xampp\apache\bin.
easy fix, not sure why it isn't installed there in the first place ¯_( ͡° ͜ʖ ͡°)_/¯

ROracle Error in .oci.Driver

I'm trying to use ROracle. My Oracle database version is Oracle Database 12c Release 12.1.0.1.0 - 64bit Production, and I have installed Instant Client and SDK for the version 12.1.0.2.0 (12.1.0.1.0 isn't available on Oracle's site).
I can access the Oracle database through Oracle SQL Developer without any issues. The error message I get in RStudio is:
Error in .oci.Driver(.oci.drv(), interruptible = interruptible, unicode_as_utf8 = unicode_as_utf8, :
In case it's useful, I have installed Instant Client and SDK here:
C:\oreclient_install_dir\instantclient_12_1
I'm running a Windows machine and I followed the instructions on CRAN:
http://cran.us.r-project.org/web/packages/ROracle/INSTALL
Including adding the environment variables.
After some searching (e.g. here) it looks like I need to set LD_LIBRARY_PATH and ORACLE_HOME and "OCI_LIB", which I did:
Sys.setenv(LD_LIBRARY_PATH="C:/oreclient_install_dir/instantclient_12_1")
Sys.setenv("ORACLE_HOME" = "C:/oreclient_install_dir/instantclient_12_1")
Sys.setenv("OCI_LIB" = "C:/oreclient_install_dir/instantclient_12_1")
Same error comes up. I'm likely not doing this right, however; I'm not a DBA and don't know all the details.
Any help with this would be appreciated.
LD_LIBRARY_PATH is for Linux. Assuming that you already have Rtools installed in C:\Rtools, you can use the following code to install ROracle
Sys.setenv(OCI_LIB64="C:\\oreclient_install_dir\\instantclient_12_1")
Sys.setenv(PATH=paste0(Sys.getenv("PATH"),";C:\\oreclient_install_dir\\instantclient_12_1"))
install.packages("ROracle", type="source", INSTALL_opts="--no-multiarch")
For using the ROracle package, you can use the following:
Sys.setenv(OCI_LIB64="C:\\oreclient_install_dir\\instantclient_12_1")
Sys.setenv(PATH=paste0(Sys.getenv("PATH"),";C:\\oreclient_install_dir\\instantclient_12_1"))
library(ROracle)

ORA-12547: TNS Lost Contact when running DBCA on Oracle 11g installation on Ubuntu Linux 12.04 64 bit

I'm trying to create a database using DBCA on Oracle 11g installation on Ubuntu Linux 12.04 64 bit.
I followed the instructions here, but I get
ORA-12547: TNS Lost Contact when running DBCA.
Below are the details. Can someone assist with the solution?
Instead of using /opt/oracle as the "oracle" user home, I used /home/oracle
I did not install the libstdc++5 in 32 bit version
I did everything else the same as the posting
Installation resulted in "missing packages". I tried to do an apt-get install for these packages from ubuntu, but ubuntu says that they don't exist.
Then I saw in the instructions:
Once you will reach the "pre-reqs" screen, check "Ignore all" to continue the installation.
When running ./dbca from $ORACLE_HOME/bin, it fails with ORA-12547.
I checked $ORACLE_HOME/network/admin and listener.ora , sqlnet.ora , and tnsnames.ora all look OK.
However, I think that tnsnames.ora is not being read properly, because ./tnsping fails and the error message states that "EZ Connect" was used.
But in my sqlnet.ora , I have
names.directory_lookup = (TNSNAMES,EZCONNECT)
It should use EZ Connect only after tnsnames is tried.
Also, I sometimes get ORA-12541: No listener. I tried running ./netca. Everything is OK until I perform a test on the listener, and it fails.
I can't run ./lsnrctl. Absolutely nothing happens for this, as well as lsnrctl start, stop, status.
I can't go through sqlplus. If I run ./sqlplus , it asks me for username/password directly.
If I do ./sqlplus / as sysdba, then this results in "ORA-12547: TNS lost contact".
All environment variables are set correctly in .bashrc.
I tried re-running root.sh , but the problem is not fixed.
/etc/oratab is OK
/etc/hosts is OK, but I can't always ping the "localhost" or "127.0.0.1", or "ubuntu" or "127.0.1.1"
The same TNS or Listener errors display.
When I login in oracle (sqlplus system/pass as sysdba), I got this:
ERROR:  
ORA-12547: TNS :lost contact when try to connect to Oracle.
First, I think the server is down, but I check it, it is OK. And so many body say 'chmod 6751 oracle', I did it, but I got another error:
ERROR:
ORA-01031: insufficient privileges
Enter user-name:
finally, I switch the system user from root to oracle. And I login success.
Ensure the DB is up and running and you can connect locally AS SYSDBA to the database
using Oracle binaries owner (usually oracle:oinstall Unix / Linux user). If it does not
work, probably you encounter a different problem.
1. Check privileges of an Oracle file on Unix / Linux host where database is running:
cd $ORACLE_HOME/bin
ls -ltr oracle
2. Change permissions as below:
chmod 6751 oracle
ls -ltr oracle
This code may help you lot.

Resources