Unable to load driver: com.mysql.jdbc.Driver - php

I try to use Jasper to generate report in Laravel. It's work perfect if I didn't use database, if I add database to get data from mysql database he gives me an error "Unable to load driver: com.mysql.jdbc.Driver". I install JDBC Connector and Setup ODBC connection to local mysql server:
Also I setup CLASSPATH to MySQL connector:
Because laravel print me that have some error to generate pdf with database connection I change it to print output command and ran it in terminal and he gives me an error that "Unable to load driver: com.mysql.jdbc.Driver", see next picture:
If you have ANY idea I will be grateful!

A lot of Java applications do not use the CLASSPATH environment variable, and it looks like jasperstarter is one of them.
Looking at http://jasperstarter.cenote.de/usage.html you need to use the command line option --jdbc-dir <directory with driver jar(s)>:
--jdbc-dir <dir> directory where jdbc driver jars are located. Defaults to ./jdbc
Alternatively, as you indicated in the comments, you can put the driver in the JasperStarter/jdbc folder, as that is the default location.

Related

PHP, SQLite on windows using doctrine

i must connect to sqlite db file using doctrine,
when i copy db file to php(composer) project i can easily connect to DB,
but when i try to make absolute path it says SQLSTATE[HY000] [14] unable to open database file
i'm using symfony4.2 project for it and doctrine2.5
my .env is like this
DATABASE_WSW="sqlite:////C:\\Program Files\\programX\\db.sqlite" or
DATABASE_WSW="sqlite:////C:\Program Files\programX\db.sqlite" or
DATABASE_WSW="sqlite:////C:/Program Files/programX/db.sqlite"
above examples don't work
when used like this works:
DATABASE_WSW=sqlite:///db.sqlite
what I'm doing wrong?

Getting error messages while connecting to snowflake database though ODBC

I am using Ubuntu, I am trying to connect php to snowflake using ODBC driver, I have added driver information in /etc/odbcinst.ini. Here is the driver information, that I am using
[ODBC Drivers]
SnowflakeDSIIDriver=Installed
[SnowflakeDSIIDriver]
APILevel=1
ConnectFunctions=YYY
Description=Snowflake DSII
Driver=path-to-"libSnowflake.so"
DriverODBCVer=03.52
SQLLevel=1
ErrorMessagesPath=path-to-folder-which-has-error-message-xml-files
I am getting error two erros
The error 1 : SFRestRequestFailed could not be found in the en-US locale. Check that /en-US/SFMessages.xml exists.
The error 2 : REST request to the Snowflake is failing(I got this error by checking corresponding message attached to 'SFRestRequestFailed' in SFMessages.xml).
But I am able to connect Snowflake and fetch data using same access details in windows.
Kindly share your ideas to resolve this issue.
Thank you
ErrorMessagePath is a snowflake configuration. If you use the snowflake odbc package for linux, you will find unixodbc.snowflake.ini or iodbc.snowflake.ini which you can use accordingly depending on which driver manager you are using. ErrorMessagePath should be set in unixodbc.snowflake.ini or iodbc.snowflake.ini and your SIMBAINI env var should be set to point to one of these files.

Laravel sqlite saying the database is "encrypted or is not a database"

I have a database file on my computer called testing.sqlite, which contains a copy of me database that I want to use for testing (rather than connecting to my ordinary MySQL production server).
I created an entry in the config/database file in laravel as instructed, setting it to access the sqlite file, and it all look right. But when I try and actually do anything, I get the error message:
[Illuminate\Database\QueryException]
SQLSTATE[HY000]: General error: 26 file is encrypted or is not a database (SQL: select * from sqlite_master where type = 'table' and name = vendor_alerts)
I can access the file using sqlite testing.sqlite from the command line, why can't laravel read it?
The problem is that the version of sqlite is different. Laravel uses sqlite3, wheareas the sqlite command on your console might be an earlier version. Run sqlite -version from the command line to check your version - is is probably 2 something. You need to install sqlite3, and you'll find that it is not compatible - i.e. sqlite3 testing.sqlite will produce the same error you are getting from laravel.
So, upgrade your command line sqlite version, and copy the data into a new sqlite3 database, and laravel will work without trouble.

reverse database won't work from terminal (PROPEL / BAKE CAKEPHP)

I've been trying to generate model classes from a local database using both propel and bake for cakephp , it seems that i have the same problem :
When I try to acces the database through bake or propel it gives me an error that it can't open the connection:
So I tried this :
I try to acces the database from the application using pdo it works just fine!!!
When I tried to acces database through terminal it's also working !!!
I really don't know what's the problem here !
You most likely have a separate php.ini config file for CLI and pdo_mysql is not loaded for CLI.

Can't connect to postgreSQL database through php pdo driver

I've decided to switch from MySQL to PostgreSQL recently, mostly just to learn a new DB. It's been pretty painful, but I think I'm close.
I'm using php and PDO, my PDO driver has been successfully install and configured.
Opening my site, I get the error:
Connection failed: SQLSTATE[08006] [7] FATAL: Ident authentication failed for user "postgres"
I'm using the following connection calls (I've tried a few variations of calling user/pw in the $dsn variable, and in separate $user/$pass variables, and including port=5432):
$dsn = 'pgsql:dbname=db1;host=localhost;user=postgres;password=pass';
$db = new PDO($dsn);
Also, I'm able to log into my db from the command line:
$ su postgres
(pass)
$ psql db1
output:
could not change directory to "/home/ec2-user" psql (8.4.9) Type
"help" for help.
db1=#
Any ideas? I'd love to provide more info if needed.
Is your pg_hba.conf file all right? It's a known source of pain at the beginning w/ PostgreSQL. And, the situation you mention, is a good candidate for such kind of a problem. :-)

Categories