Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Crystal reports with PostgreSQL

Hello!

I have a PostgreSQL database (8.3) and want to attach it to Crystal reports for eclipse.

I'm using the following code for this purpose:

   public void attachCrystalReportsToDatabase(final DatabaseController aDatabaseController)
   {
      final String DBUSERNAME = "postgres";
      final String DBPASSWORD = "postgres";
      final String CONNECTION_STRING = "Use JDBC=b(true);"
            + "Connection URL=s(jdbc:postgresql://localhost/MyDatabaseName);"
            + "Database Class Name=s(org.postgresql.Driver);Server=s(localhost);"
            + "User ID=s(postgres);Password=;Database=s(MyDatabaseName);Trusted_Connection=b(false);"
            + "JDBC Connection String=s(!org.postgresql.Driver!jdbc:postgresql://localhost/MyDatabaseName;"
            + "DatabaseName={database};user={userid};password={password}!)";
      final String DATABASE_NAME = "MyDatabaseName";
      final String URI = "!org.postgresql.Driver!"
            + "jdbc:postgresql://localhost/MyDatabaseName;DatabaseName={database};"
            + "user={userid};password={password}!";
      final String DATABASE_DLL = "crdb_jdbc.dll";

      final Tables tables = aDatabaseController.getDatabase().getTables();

      for (int counter = 0; counter < tables.size(); counter++)
      {

         final ITable table = tables.getTable(counter);

         table.setName(table.getName());
         table.setAlias(table.getAlias());

         table.setQualifiedName(table.getName());

         final IConnectionInfo connectionInfo = table.getConnectionInfo();

         final PropertyBag propertyBag = new PropertyBag();

         propertyBag.put("Trusted_Connection", "false");
         propertyBag.put("Connection String", CONNECTION_STRING);
         propertyBag.put("Database Name", DATABASE_NAME);
         propertyBag.put("Server Type", "JDBC (JNDI)");
         propertyBag.put("URI", URI);
         propertyBag.put("Use JDBC", "true");
         propertyBag.put("Database DLL", DATABASE_DLL);

         connectionInfo.setAttributes(propertyBag);

         connectionInfo.setUserName(DBUSERNAME);
         connectionInfo.setPassword(DBPASSWORD);
         connectionInfo.setKind(ConnectionInfoKind.SQL);


         table.setConnectionInfo(connectionInfo);

         try
         {
            aDatabaseController.setTableLocation(table, tables.getTable(counter));
         }
         catch (ReportSDKException exception)
         {
            LOGGER.error("", exception);
         }
      }
   }

I am getting following exception, when I execute this code:

2008-09-12 20:48:56,011 [database.PostgreSQLConnection] ERROR com.crystaldecisions.sdk.occa.report.lib.ReportSDKLogonException: Fehler bei der Anmeldung: FATAL: no PostgreSQL user name specified in startup packet---- Error code:-2147217393 Error code name:dbLogonFailed at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(Unknown Source) at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source) at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source) at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.ag.a(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.av.if(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.an.new(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.cb.for(Unknown Source) at com.crystaldecisions.proxy.remoteagent.u.performDo(Unknown Source) at com.crystaldecisions.proxy.remoteagent.u.a(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.DatabaseController.setTableLocation(Unknown Source) at com.crystaldecisions.reports.sdk.DatabaseController.setTableLocation(Unknown Source) at database.PostgreSQLConnection.attachCrystalReportsToDatabase(PostgreSQLConnection.java:361)

What am I doing wrong?

Thanks in advance

Dmitri Pissarenko

Former Member
Not what you were looking for? View more on this topic or Ask a question