Hello,
I'm writing this because I've run out of options. I'm trying to write a java
application to access a postgresql database here on our system, but I'm getting
an error that I don't understand when the application runs. I would appreciate
any help that you can give as I am unsure how to solve this.
Here is the beginning of the code that is causing the error:
public class QALogUpdater // Create the class
{
public void updateLog() throws ClassNotFoundException, SQLException
{ // The routine to update the QA Log
String command = new String();
String db = new String("jdbc:postgresql://yngvi/qa_log_test");
String usr = new String("mda");
String pwd = new String("blah");
Class.forName("org.postgresql.Driver");
// Load database interface
java.sql.DriverManager.setLogStream(java.lang.System.out);
Connection conn =
DriverManager.getConnection( db, usr, pwd );
Statement stmt = conn.createStatement();
When executing the "Connection conn = ..." statement, I get the following error:
DriverManager.getConnection("jdbc:postgresql://yngvi/qa_log_test")
trying driver[className=org.postgresql.Driver,org.postgresql.Driver@6a9d42]
java.sql.SQLException: ERROR: MultiByte strings (MB) must be enabled to use this function
at org.postgresql.Connection.ExecSQL(Connection.java:533)
at org.postgresql.Connection.ExecSQL(Connection.java:400)
at org.postgresql.Connection.openConnection(Connection.java:270)
at org.postgresql.Driver.connect(Driver.java:122)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at qa.shared.QALogUpdater.updateLog(QALogUpdater.java:50)
at qa.shared.Result.reportResult(Result.java:127)
at qa.analyzer.ConfigFileReader.<init>(ConfigFileReader.java:83)
at QAAnalyzer.main(QAAnalyzer.java:156)
java.lang.NullPointerException
Our system manager assures me that he has re-configured Postgress with the
multibyte option as indicated on the online help web page in the following
manner: % ./configure --enable-multibyte
I had him do this even though we are not using anything other than ASCII in our
databases due to the error message. We are using Java version 1.3 on a Unix
Solaris 7 OS machine. He isn't sure of which version of Postgres we are using
but the pgsql application is version 6.5.3. He thinks it is fairly current but
probably not the most current version.
I'm not sure what the problem is or what MultiByte has to do with anything but
I really need some help on this. If there is any other information you need, just
ask. And if there is someone else that you think could help me more, please let
me know.
Interestingly, when I replace the Connection statement with the following:
Connection conn =
DriverManager.getConnection( db );
I don't get the stack trace, but I do get the NullPointerException. The database
being accessed does not require passwords normally, if that makes a difference, but
I've also created it with password protection enabled but that didn't affect
anything.
Thanks for any help you can offer.