cooperl22 / laravel-db2

laravel-db2 is a simple DB2 service provider for Laravel. It provides DB2 Connection by extending the Illuminate Database component of the laravel framework.
Other
59 stars 63 forks source link

Table name using lower case #66

Open gavnyx opened 4 years ago

gavnyx commented 4 years ago

I have a trouble while using query builder because my table name in db2 using lower case. How to fix this? I try double quote but not fixed it.

Error message without quote ($users = DB::table('users')->get();): Illuminate\Database\QueryException SQLSTATE[42S02]: Base table or view not found: -204 [IBM][CLI Driver][DB2/LINUXX8664] SQL0204N "APP_PUTUSAN.USERS" is an undefined name. SQLSTATE=42704 (SQLNumResultCols[-204] at /tmp/PDO_IBM-1.3.6/ibm_driver.c:153) (SQL: select * from users)

Error message when using double quote ($users = DB::table('"users"')->get();): Illuminate\Database\QueryException SQLSTATE[42601]: Syntax error: -104 [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token """" was found following "select from ". Expected tokens may include: "". SQLSTATE=42601 (SQLNumResultCols[-104] at /tmp/PDO_IBM-1.3.6/ibm_driver.c:153) (SQL: select from ""users"")

Note: I can get that data using raw query like this: $users = DB::select('select * from "users"'); // I'm using double quote on table name

serininformatica commented 3 years ago

i have the same problem with lower case field name