unixODBC Data source name not found, and no default driver specified - laravel-5

I'm trying to connect to a db2 server from my Laravel application. Since Laravel doesn't support db2 out of the box, I tried using this package https://github.com/cooperl22/laravel-db2, which requires me to install odbc driver.
So far, I've been able to install odbc using the following command:
apt-get install php-odbc
However, it seems like my /etc/odbc.ini and /etc/odbcinst.ini configuration are still wrong. and here's the full error message when I tried to run php artisan migrate:
[PDOException]
SQLSTATE[IM002] SQLDriverConnect: 0 [unixODBC][Driver Manager]Data source name not found, and no default
driver specified
Here's my /etc/odbc.ini:
[db2]
Description=DB2 Server
Driver=db2
Database=mydb
and here's my /etc/odbcisnt.ini:
[db2]
Description = DB2 database access
Driver = /opt/ibm/db2/V10.5/lib64/libdb2.so
FileUsage = 1
DontDLClose = 1

Ensure that your environment variables are set correctly. As shown on this link, make sure the following is set:
export DB2INSTANCE=db2inst1
isql -v sample db2inst1 ibmdb2
Exerpt from the unixodbc.org page I linked to above:
Then when it comes to connecting, you MUST have the environment
variable DB2INSTANCE set to a vaild db2 instance, so for instance to
connect with isql
Both of your config files look correct to me. (The isql part was just an example to test connectivity.)

Related

lsnrctl: command not found in Ubuntu 18.04

I am trying to make connection to Oracle Database 18c XE with sqldeveloper,
but I am getting :
Status : Failure -Test failed: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
So I am trying to start my listener, which I have inside
/opt/oracle/product/18c/dbhomeXE/network/admin/samples
And I am getting lsnrctl: command not found
I am also getting the same message for sqlplus which is inside /opt/oracle/product/18c/dbhomeXE/bin
I know that you are going to say Oracle is not supported for Ubuntu,
but I am really only capable of using Ubuntu..
[CLOSED] I successfully was able to connect to oracle database via sqldeveloper 17.3 by following this link steps and guide:
http://meandmyubuntulinux.blogspot.com/2012/06/trouble-shooting-oracle-11g.html
You need to run following steps to access Oracle executables as documented in Installation Guide for Linux x86-64:
$ export ORACLE_SID=XE
$ export ORAENV_ASK=NO
$ . /opt/oracle/product/18c/dbhomeXE/bin/oraenv
ORACLE_HOME = [] ? /opt/oracle/product/18c/dbhomeXE
The Oracle base has been set to /opt/oracle
oraenv will set PATH to the right setting.

Oracle 11g XE - Can't login and database is down

Just installed Oracle 11g XE (Windows), but can't connect in SQL Developer or run any command in CLI.
When try to connect in CLI using SYS or SYSTEM with password defined during the install, get the following error:
ORA-12638: credential retrieval failed
When I tray to connect via SQL Developer (tried via SID and Service Name, hostname=localhost, port=1521, SID=xe), get this error:
Status : Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in
connect descriptor
Already tried change SQLNET.AUTHENTICATION_SERVICES = (NTS) to (NONE) in sqlnet.ora file. When I do this, get the following error when try to connect with the SYS or SYSTEM user and password:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Already tried every solution in Google results, like reinstall, stop and start services... Mostly ask for first connect in CLI to make some changes, but even this I can't accomplish.
Any suggestions on how connect to the database?
Found the solution:
I was installing in my company Windows user domain.
First uninstall any instance of Oracle XE 11g.
Switch to a local administrator Windows user and install Oracle XE 11g.
Sign off and back to company Windows user.
Edit the file C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\sqlnet.ora (or equivalent to your installation path). Change SQLNET.AUTHENTICATION_SERVICES = (TNS) to SQLNET.AUTHENTICATION_SERVICES = (NONE).
This change will allow you connect to database from you company Windows user.
As seen here: Error ORA-12638 in Oracle Database 11g
Try the following: Open command window, cd to Oracle bin directory, enter sqlplus /nolog. If you get a prompt enter connect / as sysdba. If you get connected then you can try "startup".
- -
Did you try to start the Oracle RDBMS service via Services (services.msc)?
Do you use an spfile? Check the registry for ORA_SID_NAME_PFILE that is different from default location of $ORACLE_HOME/dbs. Also check the default location. Use only the default location or the registry entry removing either the registry entry or the file in the default location depending on which you want to use.

FATAL: no pg_hba.conf entry for host when setting up blazer gem

My application uses the blazer gem for visualizing DB queries.
During the setup I've encountered the following error:
FATAL: no pg_hba.conf entry for host "111.22.33.44", user "blazer", database "my_db", SSL off
My application is hosted on EngineYard and uses PostgreSQL.
How can I find and modify the pg_hba.conf on EngineYard?
upd
I do have SSH access to EngineYard cloud.
Instance: General Purpose (M3) Large.
OS: EngineYard's Gentoo.
You can try the following steps. I've assumed that your DB name is my_db.
Connect to the instance via SSH (the link can be found on the EngineYard environment page)
Connect to the
database as superuser psql -U postgres -h localhost -d
my_db. If you don't have the password, check your database secrets here /data/my_db/current/config/database.yml
After connecting to DB identify location of hba file by typing SHOW
hba_file;
Quit psql by typing \q
Use previously identified path to open the hba_file file and add the missing user. E.g via vim sudo vim /db/postgresql/9.5/data/pg_hba.conf. Note the sudo command
The use should be added under # IPv4 postgres
user for 10.x with md5:
Connect to the database again
Reload the configuration via select pg_reload_conf(); command
After all steps are performed, Blazer queries should be accessible.

HIVE ODBC connector settings

I configured unixodbc to use the hive connector from cloudera in my Linux Mint machine,
but I keep receiving the following error when trying to connect to hive (e.g. using isql -v hive)
S1000][unixODBC][Cloudera][ODBC] (11560) Unable to locate SQLGetPrivateProfileString function.
[ISQL]ERROR: Could not SQLConnect
I think I set the /etc/odbcinst.ini and the ~/.odbc.ini in the correct way:
# content of /etc/odbcinst.ini
[hive]
Description = Cloudera ODBC Driver for Apache Hive (64-bit)
Driver=/opt/cloudera/hiveodbc/lib/64/libclouderahiveodbc64.so
ODBCInstLib=libodbcinst.a(libodbcinst.so.1)
UsageCount = 1
DriverManagerEncoding=UTF-16
ErrorMessagesPath=/opt/cloudera/hiveodbc/ErrorMessages/
LogLevel=0
SwapFilePath=/tmp
and my ~/.odbc.ini file contains:
[hive]
Description=Cloudera ODBC Driver for Apache Hive (64-bit) DSN
Driver = hive
ErrorMessagesPath=/opt/cloudera/hiveodbc/ErrorMessages/
# Values for HOST, PORT, KrbHostFQDN, and KrbServiceName should be set here.
# They can also be specified on the connection string.
HOST= <the host>
PORT= <the port>
Schema=<the schema>
# .. etc
Can you help me find out what is causing the error?
What does
ldd /opt/cloudera/hiveodbc/lib/64/libclouderahiveodbc64.so
Show you?
It may be that the driver is not linked to libodbcinst.so.
You could try a
LD_PRELOAD=/usr/local/libodbcinst.so
or wherever libodbcinst.so is on your machine.
Are you sure that you ODBCInstLib is set properly?
I was hitting the same issue with a Vertica driver and my libodbcinst.so.1 ended up needing an absolute path: /usr/lib/x86_64-linux-gnu/libodbcinst.so.1
I determined the path by running a Find for libodbcinst.so.

How I configure shell sqlplus to oracle

I'm working in a new developer environment. How I set connection with oracle, because I need to execute any scripts, but I received the message: SQLPLUS NOT FOUND :/
you need to add $ORACLE_HOME/bin into your PATH. and check if $ORACLE_HOME is defined first. If it's not ,define it (just the root folder of your oracle client).
If you don't have an oracle client installed you need to install one

Resources