Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem (and solution) on IBMI with driver db2_ibmi_ibm #59

Open
AlexandreBeauduin opened this issue Jan 29, 2020 · 1 comment
Open

Comments

@AlexandreBeauduin
Copy link

AlexandreBeauduin commented Jan 29, 2020

Hi,

I just installed Laravel 6.12.0 and Cooperl/laravel-ibmi on Zendserver 2019.0.3 on IBMI (PHP version 7.2.24).
I copied the config from this github page and replaced database, username, password, ... to my needs.
driver => db2_ibmi_ibm

When I make a query (through Model or DB facade, I get:

PDOException {#256 ▼
#message: b"SQLSTATE=42705, SQLConnect: -950 DRIVER={IBM i Acce absente du répertoire des bases de données relationnelles."
#code: 0
#file: "/www/zendphp7/htdocs/twins_api_l6/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php"
#line: 70
+errorInfo: null
trace: {▶}
}

To fix this, I had to go Cooperl\Database\DB2\Connectors\IBMConnector and replace this line :

$dsn = "ibm:DRIVER={$config['driverName']};DATABASE={$config['database']};HOSTNAME={$config['host']};PORT={$config['port']};PROTOCOL=TCPIP;";

with this one:
$dsn = "ibm:{$config['database']}";

Then it works.

After doing this, I can even comment out the host, driverName and port from config/database.php, it still works.

I tried to find more info on the DSN and how to "write" it but did not find any clues on how to specify the host, port, etc...

Is it normal ? What did I miss ?

Sorry for my bad English :)

@CedricGnn
Copy link

Hi,

Is there any news about this issue ?

Can we implement something like $config['dsn'] to replace the whole getDsn() method ?
Like if there's a dsn configuration then we don't have to get it from getDsn(), preventing the issue and keeping the feature usable ?

Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants