Menu

Using jxDBCon

Help
John Tram
2001-08-11
2002-08-12
  • John Tram

    John Tram - 2001-08-11

    Is this the correct way to load the driver:

    Class.forName(org.sourceforge.jxdbcon.JXDBConDriver);

    This is what I'm doing, but i get this error:java.sql.SQLException: No suitable driver

    Any ideas? 

    Thanks.

    John

     
    • Greg Ambrose

      Greg Ambrose - 2001-09-15

      Yes well I'm getting the same and can't see what I'm doing wrong. Any help would be much appreciated as this is holding up a few projects of mine.

      I am loading the driver with :-

            Class.forName("org.sourceforge.jxdbcon.JXDBConDriver");

      Then connecting with :-
              db = DriverManager.getConnection("jdbc:postgresql://192.168.100.3:5432/eg1","postgres","abc");

      This gets the exception :-

      java.sql.SQLException: No suitable driver

       
    • Keve Müller

      Keve Müller - 2001-09-15

      Hi.
      I must have overlooked that post, sorry.
      The class is correct.
      The URL is not.
      You're URL should read:
      jdbc:postgresql:net//192.168.100.3:5432/eg1
      or
      jdbc:postgresql:net//192.168.100.3/eg1 with the defaults omitted.
      For the complete description of the URL syntax and other useful hints please look at the documentation section of the homepage: http://jxdbcon.sf.net/documentation

      Keve

       
    • Greg Ambrose

      Greg Ambrose - 2001-09-16

      Keve,
      That was great, and it all worked.

      I've gone on to create a table with a blob in it as follows :-

             try
              {
                   stmt = db.createStatement();

                      stmt.executeUpdate( "CREATE TABLE TeeColor (" +
                       "TColor      VARCHAR (10)  NOT NULL, " +
                       "TCBlob      BLOB  ) "  );
              }

      This gets the error    "Unable to locate type name 'blob' in catalog"

      I changed BLOB to oid, being the PG data type, and this meant the table created successfully. Within PG the column was set to type oid as you would expect.

      I then tried to insert a row, as follows :-

             try
              {
                  pstmt = db.prepareStatement(
                  "INSERT INTO TeeColor VALUES( ?, ? )" );

                  pstmt.setString( 1, "chloe" );
              }
              catch(SQLException e)
              {
                  System.out.println(
                      "Cant Prepare" + e);
                  return;
              }

              fFile = new File( "L:/www/eg/eg3/chloe.jpg" );

              try
              {
                  isImage = new FileInputStream( fFile );

                  pstmt.setBinaryStream(2,isImage,(int)(fFile.length()));

                  pstmt.executeUpdate();
               }

      With the following error :-

      org.sourceforge.jxutil.sql.I18nSQLException: unsupported conversion

      I also tried setBytes, with the same error.

      I hope you can help,
      Greg

       
    • arie

      arie - 2001-10-10

      I am using Forte for Java 3.0, on Suse Linux 7.2 and Postgresql 7.0.3.

      I am having difficulty getting metadata. I use the Connection.getMetaData no problem, I then try the getPrimaryKeys() method but when I try to use the ResultSet.getString(...) I get a null pointer exception. In addition when I use Fortes built in test on the driver it gives me the following message:

      warning: no tables were found. check your database.
      warning: no view were found. check your database.
      warning: no procedures were found. check your database.

      Can you help me with this?

       
    • Keve Müller

      Keve Müller - 2001-10-10

      I've now downloaded Forte and can confirm this.

      I'll be investigating both problems and send a followup.

      Keve

       
    • Keve Müller

      Keve Müller - 2001-10-12

      FFJ Problem:

      Forte "tests" the driver by issuing calls to DatabaseMetaData:

      getDriverName, storesLowerCaseIdentifiers, getCatalogs, getUserName, getTables,  getDatabaseProductName, getTables, getProcedures

      The problem is, that it uses the name obtained with getUserName in the SCHEMA parameter for the subsequent calls. PostgreSQL does not support schemas, the driver returns no Table/Procedure etc. entry if a SCHEMA parameter other than null or % is given.

      The same applies to the JDBC browser of Forte, which uses an empty String for the SCHEMA parameter.

      I consider this a flaw in Forte, JDBC allows databases not to support SCHEMAS. The proper way of handling this is to supply a null parameter.

      Nevertheless I am open to proposals for fixing this issue and make a workaround for Forte. I would appreciate if anyone, who has more profound knowledge of Forte could make a proposal.

      getPrimaryKeys problem:

      Please submit more information. Are You using the current driver, what parameters do You pass to getPK, what is returned, which column gives the NullPointerException and where.

      Keve

       
    • Anonymous

      Anonymous - 2001-10-30

      I submitted this bug (Forte should not require database to support SCHEMA) to Forte. I hope they will investigate and correct it in next release.

      Robert

       
    • Nobody/Anonymous

      Hello-

      I am also getting the error message: "No suitable driver"
      when I try and connect.

      I wanted to try out this jdbc driver to compare it with the
      standard postgres jdbc driver. I changed the code to use
      the new driver.

      The following works:

          Class.forName("org.sourceforge.jxdbcon.JXDBConDriver");

      so, CLASSPATH appears to be ok.

      I try and connect using the following URL:

          jdbc:postgresql:net//localhost/db1

      but get the "No suitable driver" error. I also tried omitting
      ":net", replacing it with ":lib", usiging ":5432", and using the
      IP instead of host.

      Any ideas would be greatly appreciated!

      Thanks,

      Bob

       
    • Nobody/Anonymous

      Never mind-

      I added "import" at the top and the error went away.

      Red-faced,

      Bob

       

Log in to post a comment.