5 Replies Latest reply on Feb 20, 2008 8:06 AM by catalinanastasoaie

    Unable to connect to PostgreSQL DB

    mcaudy
      I have been able to connect to MySQL DBs fine with Flex Builder 3 to connect them to Flex datagrid forms, by using the Data menu -> "Create Application from Database" approach. However, when I try to connect to PostgreSQL DBs using the same approach, I get an error when I try to select the PostgreSQL JDBC Driver Definition in the Data Source directory:

      "Unable to locate jar/zip in the file system, as specified by the driver definition postgresql-8.1-404.jdbc2.jar".

      Similarly, if I go to the Connections setting in the Preferences, and select the PostgreSQL driver, the same message appears.

      I have located the postgresql-8.1-404.jdbc2.jar file in the ".metadata/.plugins/com.adobe.datatools.derived/drivers/postgresql-8.1-404.jdbc2.jar", and it is there along with the mysql driver, and looks OK.

      I have Googled for information about the error, but have not found anything similar.

      Can anybody suggest how to correct this error so that I can access Postgres DBs?

      Thanks.
        • 1. Re: Unable to connect to PostgreSQL DB
          catalinanastasoaie Level 1
          Hi,

          The Flex Builder doesn't offer support for PostgreSQL by default so you will have to manually setup it. First you need to go to the PostgreSQL website and download the jdbc driver ( http://jdbc.postgresql.org/download.html). Then from the Connections settings panel in the Preferences remove the old driver and add the driver that you have downloaded.

          Thanks,
          Catalin Anastasoaie
          • 2. Re: Unable to connect to PostgreSQL DB
            mcaudy Level 1
            Hi Catalin,

            Thanks for your suggeston, which I have tried to follow.

            As suggested, I went to: http://jdbc.postgresql.org/download.html. The only 8.1 jdbc2 driver there was for v412 not v404, which was the number of the original driver in Flex Builder 3.

            I downloaded that postgresql-8.1-412.jdbc2.jar anyway, and copied it into the

            Flex\ Builder\ 3/.metadata/.plugins/com.adobe.datatools.derived/drivers/

            folder, where the JDBC drivers are located, after first moving the original driver into another directory

            Then went to FB3 Preferences, Connections, and removed the PostgreSQL JDBC Driver Definition, using the GUI tool, and added the new postgresql-8.1-412.jdbc2.jar


            I then got a message saying:

            "Required property in driver definition missing value: User ID"
            I added User ID: "root" and it accepted this change

            However, a message then appeared saying:
            "Required property in driver definition missing value: password"

            When I added the root password and clicked OK, it did not seem to save
            the password slot became empty, and the message was still there.

            I closed the GUI window, and went back to Preferences to see if the message was now gone, but it was still therre;
            "Required property in driver definition missing value: password"

            I also tried creating a completely new connection file by selecting
            New -> other -> Select as Wizard window -> open "Connection Profiles -> Wizard Selection Page
            select "Postgres JDBC connection" -> "Create connection profile"
            Name:
            Description:
            checkbox: auto-connect

            "Specify a Drive and Connection Details" window opens
            Select a driver from the drop-down
            -> "PostgreSQL JDBC Driver"
            Connection URL: jdbc:postgresql:postgres
            Database name: postgres
            Driver Class: org.postgresql.Driver
            Password: blank
            User ID: root

            When I try to add any password, either for root or postgres users, it is not saved
            When I either go to Preferences -> Connections
            or try to create a new connection, I still get the same error:

            "Required property in driver definition missing value: password"

            Please advise.

            Specific questions:

            1) Is postgresql-8.1-412.jdbc2.jar a proper driver definition to use? If not, which one is.


            2) for the "PostgreSQL JDBC Driver" , are the following the correct (default) settings?
            Connection URL: jdbc:postgresql:postgres
            Database name: postgres
            Driver Class: org.postgresql.Driver
            Password: blank
            User ID: root

            Thanks,

            Mike
            • 3. Re: Unable to connect to PostgreSQL DB
              catalinanastasoaie Level 1
              Hi,

              What version of Flex Builder are you using? I tried to reproduce your problem with the password not being saved but without any luck. I was able to correctly add the driver from Eclipse main menu > Window > Preferences > Connectivity > Driver Definitios > PostgreSQL > 8.x > PostgreSQL JDBC Driver and in the Edit Driver Definition add the password and userID. As for the question regarding v412 and v404, the 412 is just a newer version of the JDBC driver. If your are looking exactly for the 404 version here is the download link http://jdbc.postgresql.org/download/postgresql-8.1-404.jdbc2.jar

              Thanks,
              Catalin Anastasoaie
              • 4. Re: Unable to connect to PostgreSQL DB
                mcaudy Level 1
                Hi Catalin,

                The version of FB3 I am using is

                milestone 4, beta 3

                Version: 3.0.190133

                I am running Mac OS 10.4.11 on an Intel iMac.

                Should it matter whether I use PostgreSQL JDBC Driver v412 vs v404?

                Thanks,

                Mike
                • 5. Re: Unable to connect to PostgreSQL DB
                  catalinanastasoaie Level 1
                  Hi,

                  The Flex Builder 3 fully supports Creating a database connection profile only for MySQL Server and Microsoft SQL Server(You can find this in the documentation - by clicking the Help button in the Creating Application from database UI - in the Creating a database connection profile section). The remaining connection profiles are provided by the Eclipse - DTP plugin. It appears that on MAC OS there is an issue with the postgresql driver - you cannot add the userID and password.

                  You can file a feature enhancement for the Creating a database connection feature on our bug tracker ( http://bugs.adobe.com/flex) in the Flex Builder - Data wizards category.

                  Thank you,
                  Catalin Anastasoaie