Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7445025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:43:22+00:00 2026-05-29T11:43:22+00:00

There are several Databases that PDO can connect to but they all require a

  • 0

There are several Databases that PDO can connect to but they all require a different connection method.

$conn = new PDO("pgsql:host=localhost port=5432 dbname=pdo", "username", "password");
$conn = new PDO("informix:DSN=InformixDB", "username", "password");
$conn = new PDO("OCI:dbname=accounts;charset=UTF-8", "username", "password")w 
PDO("sqlite:/path/to/database.sdb");

I am making a widget that will not know if the user is using a sql, SQlite, oracle or informix database but i want everything to be covered.

Question: Is there a way to check which database is available using PDO or should i just use PHP to ask which Databases are available and tell the PDO which one is being used from there?

This check will only be performed once so it isn’t extremely important that it is efficient but i would hope it is somewhat light weight.

any examples will be much appreciated as i am a novice and would enjoy a starting point.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:43:22+00:00Added an answer on May 29, 2026 at 11:43 am

    You can use PDO::getAvailableDrivers() to get a list of what is on the system.

    You will still need to build the connection string yourself (as all drivers can use wildly different parameters), but this will at least tell you what you can use on the system.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three databases that all have the contents of several web pages in
I use sql-developer to connect to several different oracle databases with several different users.
In my application I have several DataContexts that connects to different databases with different
There are several different methods for converting floating point numbers to Integers in JavaScript.
I've several databases that contains the exact same base tables with identical design. Now
I recently noticed that there are several bigint type fields in one of my
I have a SQL Server that houses Several Databases. I have a Main Database
I have some MySQL databases that have several tables that contain (amongst others) some
I have a SQL Server 2000 box that houses several databases, some of which
There have been several questions recently about database indexing and clustered indexing and it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.