doushi6932 2018-04-19 15:29
浏览 243

找不到PDO驱动程序(PhpStorm和SQLite)

I use PhpStorm to create a web page that saves data to a SQLite database. I have created tables in the DB, installed drivers in PhpStorm and it says, the connection is successful.

Ok, but when I try to open it in Chrome, it says:

Fatal error: Uncaught PDOException: could not find driver in C:\Users\maness\PhpstormProjects\icd0007\index.php:4 Stack trace: #0 C:\Users\maness\PhpstormProjects\icd0007\index.php(4): PDO->__construct('jdbc:sqlite:db1...') #1 {main} thrown in C:\Users\maness\PhpstormProjects\icd0007\index.php on line 4`

The code on line 4 within the index.php file is the following:

$connection = new PDO('jdbc:sqlite:db1.sqlite');

I have turned on every SQL extension in php.ini, tried different options - no result. Can you name the exact extensions needed to launch SQLite, or what am I doing wrong?

P.S. PhpStorm SQLite Xerial drivers. I use PHP from XAMPP folder.

  • 写回答

1条回答 默认 最新

  • doufan6886 2018-04-19 15:40
    关注

    jdbc is not a valid PDO driver.

    Since you want to connect to a SQLite database, remove jdbc from your dsn:

    $connection = new PDO('sqlite:db1.sqlite');
    

    You seem to have confused PhpStorm's SQLite connectivity with PHP's.

    评论

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作