Here’s a two‐phase blueprint:
Phase 1️⃣ – Validate you can read from the Pervasive (Sage Pastel) database via ODBC
Phase 2️⃣ – Wire that into your Laravel 8/9+ & Filament CRM
—
Phase 1: Stand-alone ODBC read test
-
Install Pervasive ODBC driver
• On Windows use the Pervasive (Actian) ODBC installer matching your Sage Pastel version (32-bit vs 64-bit!).
• On Linux you can use unixODBC + Pervasive Linux ODBC driver (if available).
-
Create a DSN
– Windows:
- Run ODBC Data Source Administrator (32-bit or 64-bit, matching the driver).
- Under System or User DSN click Add → select “Pervasive ODBC Client Interface” → configure:
• Data Source Name: PASTEL50
• Server name/IP, Port (default 1583), Database name
• Authentication credentials (Windows or Pervasive login).
– Linux (/etc/odbcinst.ini + /etc/odbc.ini):
[Pervasive]
Description = Pervasive PSQL Client
Driver = /opt/psql/lib/libodbcci.so
Setup = /opt/psql/lib/libodbcci.so
FileUsage = 1
[PASTEL50]
Description = Sage Pastel 50
Driver = Pervasive
ServerName = 192.168.1.10
DBQ = PASTELDB
UID = myuser
PWD = mypass
Port = 1583
-
Test with isql (unixODBC) or odbcad32.exe + a simple client
# on Linux with unixODBC
isql -v PASTEL50 myuser mypass
> SELECT TOP 10 Customer_Number, Customer_Name FROM AR_Customer;
– Expect to see rows. If you get errors, check DSN, network/port, credentials.
-
(Optional) Test with a GUI tool
– DBeaver, ODBC Manager, or any ODBC-capable SQL client.
Once you can successfully SELECT from Sage tables, move on.
—
Phase 2: Hook into Laravel + Filament
1. Install PHP ODBC support
# Ubuntu/Debian
sudo apt-get install php-odbc unixodbc unixodbc-dev
# CentOS/RHEL
sudo yum install php-odbc unixODBC-devel
# Then:
sudo systemctl restart php-fpm # or apache2/nginx
2. Add an ODBC connection in config/database.php
'connections' => [
// your pgsql connection here …
'pastel' => [
'driver' => 'odbc',
'dsn' => env('PASTEL_ODBC_DSN', 'PASTEL50'),
'host' => env('PASTEL_ODBC_HOST'), // optional if in DSN
'database' => env('PASTEL_ODBC_DBQ'), // optional if in DSN
'username' => env('PASTEL_ODBC_USER'),
'password' => env('PASTEL_ODBC_PASS'),
'prefix' => '', // if tables have no prefix
'charset' => 'utf8',
],
],
And in your .env:
PASTEL_ODBC_DSN=PASTEL50
PASTEL_ODBC_USER=myuser
PASTEL_ODBC_PASS=mypass
# (If you didn’t bake host/dbq into the DSN, also supply these)
3. Smoke-test in Laravel Tinker or a custom command
php artisan tinker
>>> DB::connection('pastel')
->select('SELECT TOP 5 Customer_Number, Customer_Name FROM AR_Customer');
• If you get an array of stdClass rows → success!
• Troubleshoot by enabling Laravel query logs or catching exceptions.
4. Expose a simple endpoint or Filament Page
A. Simple Route + Controller
// routes/web.php
Route::get('pastel-customers', [App\Http\Controllers\PastelTestController::class, 'index']);
// app/Http/Controllers/PastelTestController.php
namespace App\Http\Controllers;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\DB;
class PastelTestController extends Controller
{
public function index()
{
$customers = DB::connection('pastel')
->select('SELECT TOP 20 Customer_Number, Customer_Name FROM AR_Customer');
return view('pastel.customers', compact('customers'));
}
}
Create a simple Blade view to dump $customers.
B. Filament Custom Page
// app/Filament/Pages/PastelCustomers.php
namespace App\Filament\Pages;
use Filament\Pages\Page;
use Illuminate\Support\Facades\DB;
class PastelCustomers extends Page
{
protected static string $view = 'filament.pages.pastel-customers';
public $customers = [];
public function mount()
{
$this->customers = DB::connection('pastel')
->select('SELECT TOP 50 Customer_Number, Customer_Name FROM AR_Customer');
}
}
Then in filament.php register this page. In your Blade view display a table.
5. (Advanced) Read-only Eloquent Model
If you’d like Eloquent:
// app/Models/PastelCustomer.php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PastelCustomer extends Model
{
protected $connection = 'pastel';
protected $table = 'AR_Customer';
public $incrementing = false; // adapt as needed
protected $primaryKey = 'Customer_Number';
public $timestamps = false; // likely no created_at/updated_at
protected $guarded = [];
}
Then in any controller or Filament Resource you can PastelCustomer::all().
—
Troubleshooting Tips
• Driver bitness mismatch – 32-bit PHP vs 64-bit ODBC driver will fail.
• Permissions – ensure the user in DSN has read rights on Pervasive tables.
• Network/Firewall – default Pervasive port is 1583.
• Character sets – if you see garbled text, tweak charset/odbc.ini settings.
• Logs – enable Laravel’s DB::listen() or check /var/log/syslog for ODBC errors.
That’s it! You now have a verified ODBC route into Sage Pastel and a working Laravel/Filament integration. 🚀