ccovey / odbc-driver Goto Github PK
View Code? Open in Web Editor NEWLaravel 4 ODBC Driver
Laravel 4 ODBC Driver
When I try to query a table using the find method inside a phpunit test I see an error "Segmentation fault (core dumped)".
If I try to run the code inside laravel I just get a white screen in the browser.
I'm using ccovey odbc driver version v1.1.2 (reference: cc3b4ec)
Laravel 4.1
My Model looks like this:
class Customer extends Eloquent {
protected $connection = 'odbc';
protected $primaryKey = "CUSTOMER_ID";
protected $table = "CUSTOMERS";
public $incrementing = false;
public $timestamps = false;
}
When I try any of the following code:
$customer = Customer::find("ABC1");
$customer = Customer::findOrfail("ABC1");
$customer = Customer::where("CUSTOMER_ID", "=", "ABC1")->get();
$customer->save();
I get the message "Segmentation fault (core dumped)".
The following methods do work:
$customer = new Customer;
$customer = Customer::first();
$customer = Customer::whereRaw("customer_id = 'ABC1'");
If I switch my model to use a mysql connection everything works fine. What could be the issue here?
Hello,
I'm receiving the error:
SQLSTATE[IM002] SQLDriverConnect: 0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
when trying to use an eloquent model based on this driver. I'm not really sure where to begin troubleshooting. We have an installed and working odbc driver for iseries/db2. The driver is configured with UnixODBC. We are using the MySQL driver for i as well but the performance is not as good as straight db2.
Here is my model:
class ODBCCustomer extends Eloquent {
protected $connection = 'odbc';
protected $table = 'table_name';
}
Here is the code I'm using to create the model:
$test = ODBCCustomer::where('customer_number', '=', '12345');
And here is the relevant section of my database.php
'odbc' => array(
'driver' => 'odbc',
'dsn' => 'Driver={iSeries Access ODBC Driver};SYSTEM=ip_address;',
'grammar' => 'DB2',
'username' => 'username',
'password' => 'password',
'database' => '',
),
I've updated the last commit and now I get a issue: Declaration of Ccovey\ODBCDriver\ODBCDriverConnectionFactory::createConnection() should be compatible with Illuminate\Database\Connectors\ConnectionFactory::createConnection($driver, PDO $connection, $database, $prefix = '', array $config = Array)
How can I fix it?
Hi Cody,
Could you please update your readme to show the package name of "ccovey/odbc-driver-l4": "dev-master"
. It's just missing the -l4
.
Thanks
In this portion of the code:
protected function getDefaultSchemaGrammar()
{
return $this->withTablePrefix(new Schema\Grammars\Grammar);
}
Since there is no Ccovey\\ODBCDriver\\Schema\\Grammars\\Grammar
, we changed it to
protected function getDefaultSchemaGrammar()
{
return $this->withTablePrefix(new \Illuminate\Database\Schema\SqlServerGrammar);
}
And it worked fine. Sorry for not sending a PR, I don't (think I) have a database I could access via ODBC here.
Apologies if this is just user error, but at this point I'm just spinning my wheels. I'm basically getting the same error as the fellow here:
http://stackoverflow.com/questions/22838307/laravel-4-odbc-class-cannot-find-php-extension
I've verified that the extension is loaded on my system by doing a phpinfo() page and php -m. I'm wondering if this could be something as simple a casing issue. My reasoning is that the extension's name show us as PDO_ODBC in both places.
Change this:
"require": {
...
"ext-pdo_odbc": "*"
},
To this:
"require": {
...
"ext-PDO_ODBC": "*"
},
I'm sure there's a way to test this locally, but until I figure that out, I thought I'd ask here. Thanks in advance for taking the time to read this!
Having errors in running the package on laravel 4.1.X
Below is the error message, Thanks in advanced!
PHP Fatal error: Cannot use Illuminate\Database\Schema\Grammars\Grammar as Grammar because the name is already in use in /Users/andrew/Desktop/odbc/vendor/ccovey/odbc-driver-l4/src/Ccovey/ODBCDriver/ODBCDriverConnection.php on line 5
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Cannot use Illuminate\Database\Schema\Grammars\Grammar as Grammar because the name is already in use","file":"/Users/andrew/Desktop/odbc/vendor/ccovey/odbc-driver-l4/src/Ccovey/ODBCDriver/ODBCDriverConnection.php"
There is a strong chance this is a user issue, I apologize if it is
Windows 7/64, Xampp, php 5.4
Refresh application and get the following error exception.
ErrorException
Declaration of Ccovey\ODBCDriver\ODBCDriverConnectionFactory::createConnection() should be compatible with Illuminate\Database\Connectors\ConnectionFactory::createConnection($driver, PDO $connection, $database, $prefix = '', array $config = Array)
Laravel return this error The Response content must be a string or object implementing __toString(), "boolean" given. when im trying to get data with á or Ñ
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.