[JDBC] JDBC driver in pgsql 7.1 build problem
Hi, I have strange problems trying to build the JDBC driver for postgresql 7.1: /usr/local/jakarta-ant-1.3/bin//ant -buildfile ../../../build.xml -Dmajor=7 -Dminor=1 -Dfullversion=7.1 -Ddef_pgport=5432 Buildfile: ../../../build.xml jar: call: prepare: check_versions: driver: [echo] Configured build for the JDBC2 edition driver. compile: [javac] Compiling 41 source files to /usr/src/postgresql-7.1/src/interfaces/jdbc/build [javac] /usr/src/postgresql-7.1/src/interfaces/jdbc/org/postgresql/Driver.java:199: ';' expected [javac] return ${major}; [javac] ^ [javac] /usr/src/postgresql-7.1/src/interfaces/jdbc/org/postgresql/Driver.java:209: ';' expected [javac] return ${minor}; [javac] ^ [javac] /usr/src/postgresql-7.1/src/interfaces/jdbc/org/postgresql/Driver.java:199: cannot resolve symbol [javac] symbol : variable $ [javac] location: class org.postgresql.Driver [javac] return ${major}; [javac]^ [javac] /usr/src/postgresql-7.1/src/interfaces/jdbc/org/postgresql/Driver.java:209: cannot resolve symbol [javac] symbol : variable $ [javac] location: class org.postgresql.Driver [javac] return ${minor}; [javac]^ [javac] Note: Some input files use or override a deprecated API. [javac] Note: Recompile with -deprecation for details. [javac] 4 errors BUILD FAILED /usr/src/postgresql-7.1/src/interfaces/jdbc/build.xml:99: Compile failed, messages should have been provided. Total time: 9 seconds make: *** [all] Error 1 Any help would be greatly appreciated bis bald, Rolf ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
Re: [JDBC] JDBC driver in pgsql 7.1 build problem
On Thu, May 03, 2001 at 11:35:23AM +0200, Rolf Schillinger wrote: Hi, I have strange problems trying to build the JDBC driver for postgresql 7.1: try this patch: http://www.l-t.ee/marko/pgsql/ant12.diff then 'make clean', 'make' -- marko ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
[JDBC] Unable to store SHA hash
I recently migrated an application from Oracle to Postgresql 7.1. The migration was fairly painless with one exception: User's passwords are hashed using SHA, then stored in the database. Ie. // Get the hash of the password MessageDigest md=null; try { md = MessageDigest.getInstance(sha); } catch (NoSuchAlgorithmException e) { System.out.println(Error: sha encryption unavailable.); } String hashedPass = new String(md.digest(request.getParameter(pass).getBytes())); This string contains several characters that are outside the normal ASCII range. The string could be stored and retrieved using Oracle and MySQL, but in Postgres any unusual characters become '?'. This corrupts the hash and prevents users from logging on. So far, the following have been tried: - Password stored using PreparedStatement setString() call. Retrieved using ResultSet(). Verified hash corruption in the database. - Password field datatype changed from varchar to bytea. Oddly enough, PreparedStatement.setBytes() can not be used against this datatype. Resorted to using .setString(). Hash was still corrupted at the database level. Any insight into how to accomplish this task would be greatly appreciated. Jerry _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [JDBC] Returning oid or primary key
However, _if_ RETURNING is going to be in the standard SQL for the next release, _and_ there are plans to update the jdbc driver to take advantage of that in the callable statement, as well, then it makes more sense _not_ to add my patch that implements the 'overloading' of the return value in the jdbc driver. I guess the issue is the ability to return the primary key from an inserted row, for cases that it's auto-generated, such as using the serial type. Certainly the portable solution is to get RETURNING into the backend so you can decide what you want to return. -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup.| Drexel Hill, Pennsylvania 19026 ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [JDBC] multiple resource sets
Rolf, Try this ResultSet orderlines = _st.executeQuery(); while(orderlines.next()){ println(orderlines.get(1)); } orderlines.close(); _st.close(); Dave - Original Message - From: Rolf Schillinger [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 02, 2001 10:12 AM Subject: [JDBC] multiple resource sets Hi, I`m having huge troubles using postgresql JDBC. I do the following: while (orderlines.next()) { PreparedStatement as_st=db.prepareStatement(SELECT nr,beschreibung, beschreibung_2,preis FROM artikel where nr=?); System.out.println(orderlines.getRow()+ : +orderlines.getString(2)); } As result I get: 1 : KKSC025 2 : KKTO045 which is totally okay cause the underlying table data is as follows: id | nr| anzahl | eht +-++- 1226969416 | KKSC025 | 22 | BU1 1226969416 | KKTO045 | 22 | KT So far so good. I know want to process the results of that orderlines query by adding: as_st.setString(1,orderlines.getString(2)); as=as_st.executeQuery(); as.close(); to the above while loop. Output now looks like: 1 : KKSC025 2 : Nalo schmal 45/50 rauchbraun 1) is still correct while 2) has the value of as_st/as now. I`m getting desperate on that. any help would be greatly appreciated. thanks, Rolf ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED] ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [JDBC] Returning oid or primary key
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 From: Bruce Momjian [EMAIL PROTECTED] Date: Thu, 3 May 2001 13:42:23 -0400 (EDT) Certainly the portable solution is to get RETURNING into the backend so you can decide what you want to return. I agree. Is that currently planned for the next release? -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.4 (GNU/Linux) Comment: Public key at http://www.keyserver.net iD8DBQE68ZjfiysnOdCML0URAnAkAJ4h2r21+uvdZzw14Prmy8SgvqJs2QCeMMN8 YpwRmYJkfJdzZnkpqTLfI3Q= =PqCG -END PGP SIGNATURE- -- Virtually, Ned Wolpert [EMAIL PROTECTED] D08C2F45: 28E7 56CB 58AC C622 5A51 3C42 8B2B 2739 D08C 2F45 ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
[JDBC] A bug with pgsql 7.1/jdbc and non-ascii (8-bit) chars?
Hi! I have a problem like that: Environment: The database is postgresql v7.1, with locale-support jdk is sun's jdk1.3.0_02 and jdbc is that one which comes with postgres (type 2). Both database and jdbc driver has been build by myself. OS: RH 6.2 based linux with 2.4.3 kernel, glibc 2.1.3. The problem: There is a database which contains fields (the field's type is 'text') with scandinavian alphabet. (Especially ÖÄÅöäå (odiaeresis, adiaeresis, aring, or in other words, oe, ae, and a with ring above it)). The database has been installed, created and used under LC_ALL=finnish and LANG=fi_FI environment variables in act. Ok, the problem: When I try to read those field, I get guestion marks instead of those 8-bit scandic chars. I have been check my java programs and the database. (in fact, same problem appears with postgres-7.1/src/interfaces/jdbc/example/psql.java). In general, my java environment works fine with 8-bit chars, with psgl (not the java one) there is everything very well with those fields with 8-bit chars. So my question is, am I doing something wrong, or is there a bug in the pgsql-jdbc? If this is a bug or you need otherwise help or more information, please let me know. I will try to help as much as possible to hunt this one down. If I am doing something stupid, I would very likely to know it... BR, Jani --- Jani Averbach ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
Re: [JDBC] multiple resource sets
Hi Dave, Thanks for helping me but this post was kinda runaway. I thought it didn`t get through at first, forgot about it and tried upgrading the JDBC driver. After doing this now all of that stuff works. So it was an error in the JDBC driver :) bis bald, Rolf On Thu, 3 May 2001, Dave Cramer wrote: Rolf, Try this ResultSet orderlines = _st.executeQuery(); while(orderlines.next()){ println(orderlines.get(1)); } orderlines.close(); _st.close(); Dave - Original Message - From: Rolf Schillinger [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 02, 2001 10:12 AM Subject: [JDBC] multiple resource sets Hi, I`m having huge troubles using postgresql JDBC. I do the following: while (orderlines.next()) { PreparedStatement as_st=db.prepareStatement(SELECT nr,beschreibung, beschreibung_2,preis FROM artikel where nr=?); System.out.println(orderlines.getRow()+ : +orderlines.getString(2)); } As result I get: 1 : KKSC025 2 : KKTO045 which is totally okay cause the underlying table data is as follows: id | nr| anzahl | eht +-++- 1226969416 | KKSC025 | 22 | BU1 1226969416 | KKTO045 | 22 | KT So far so good. I know want to process the results of that orderlines query by adding: as_st.setString(1,orderlines.getString(2)); as=as_st.executeQuery(); as.close(); to the above while loop. Output now looks like: 1 : KKSC025 2 : Nalo schmal 45/50 rauchbraun 1) is still correct while 2) has the value of as_st/as now. I`m getting desperate on that. any help would be greatly appreciated. thanks, Rolf ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED] ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
[JDBC] Updateable ResultSet
Hello, I am brand new to this list. I looked through the mailing list archive, but couldn't determine if ResultSets are Updateable yet. I'm using some old drivers for pgsql-jdbc. Are there drivers out now that have Updateable ResultSets? Thanks! Mike ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
[JDBC] Re: A bug with pgsql 7.1/jdbc and non-ascii (8-bit) chars?
Since Java uses unicode (ucs2) internally for all Strings, the jdbc code always needs to do character set conversions for all strings it gets from the database. In the 7.0 drivers this was done by assuming the database was using the same character set as the default on the client, which is incorrect for a number of reasons. In 7.1 the jdbc code asks the database what character set it is using and does the conversion from the server character set to the java unicode strings. Now it turns out that Postgres is a little lax in its character set support, so you can very easily insert char/varchar/text with values that fall outside the range of valid values for a given character set (and psql doesn't really care either). However in java since we must do character set conversion to unicode, it does make a difference and any values that were inserted that are incorrect with regards to the database character set will be reported as ?'s in java. With regards to your specific problem, my guess is that you haven't created you database with the proper character set for the data you are storing in it. I am guessing you simply used the default SQL Acsii character set for your created database and therefore only the first 127 characters are defined. Any characters above 127 will be returned by java as ?'s. If this is the case you will need to recreate your database with the proper character set for the data you are storing in it and then everything should be fine. thanks, --Barry Jani Averbach wrote: Hi! I have a problem like that: Environment: The database is postgresql v7.1, with locale-support jdk is sun's jdk1.3.0_02 and jdbc is that one which comes with postgres (type 2). Both database and jdbc driver has been build by myself. OS: RH 6.2 based linux with 2.4.3 kernel, glibc 2.1.3. The problem: There is a database which contains fields (the field's type is 'text') with scandinavian alphabet. (Especially ÖÄÅöäå (odiaeresis, adiaeresis, aring, or in other words, oe, ae, and a with ring above it)). The database has been installed, created and used under LC_ALL=finnish and LANG=fi_FI environment variables in act. Ok, the problem: When I try to read those field, I get guestion marks instead of those 8-bit scandic chars. I have been check my java programs and the database. (in fact, same problem appears with postgres-7.1/src/interfaces/jdbc/example/psql.java). In general, my java environment works fine with 8-bit chars, with psgl (not the java one) there is everything very well with those fields with 8-bit chars. So my question is, am I doing something wrong, or is there a bug in the pgsql-jdbc? If this is a bug or you need otherwise help or more information, please let me know. I will try to help as much as possible to hunt this one down. If I am doing something stupid, I would very likely to know it... BR, Jani --- Jani Averbach ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
[JDBC] Re: Unable to store SHA hash (Non-HTML--Sorry)
Jerry, There are a couple of things going on here. First you really can't use a postgres char/varchar/text datatype to store/retrieve binary information with jdbc. (See a message I just posted to the jdbc mail list explaining character set conversions in the 7.1 jdbc drivers). So the proper datatype for binary information in Postgres is the 'bytea' type. Unfortunately there isn't any support in the jdbc drivers for this datatype (anyone want to contribute a fix???), so you really can't use that in your situation either. In my code where I need to store short pieces of binary data (like digests) I encode them in hex and store the hex. Yes this results in a 2 times increase in storage, and some overhead in encoding/decodeing, but it isn't too bad. Sure you could use other encodings for the binary data, but I find hex to be the easiest for small amounts of data. thanks, --Barry Jerry Reid wrote: I apologize if this message appears in duplicate. The original was posted before the I received notice that an additional confirmation message would be needed to get onto the list. I recently migrated an application from Oracle to Postgresql 7.1. The migration was fairly painless with one exception: User's passwords are hashed using SHA, then stored in the database. Ie. // Get the hash of the password MessageDigest md=null; try { md = MessageDigest.getInstance(sha); } catch (NoSuchAlgorithmException e) { System.out.println(Error: sha encryption unavailable.); } String hashedPass = new String(md.digest(request.getParameter(pass).getBytes())); This string contains several characters that are outside the normal ASCII range. The string could be stored and retrieved using Oracle and MySQL, but in Postgres any unusual characters become '?'. This corrupts the hash and prevents users from logging on. So far, the following have been tried: - Password stored using PreparedStatement setString() call. Retrieved using ResultSet.getString(). Verified hash corruption in the database. - Password field datatype changed from varchar to bytea. Oddly enough, PreparedStatement.setBytes() can not be used against this datatype. Resorted to using .setString(). Hash was still corrupted at the database level. Any insight into how to accomplish this task would be greatly appreciated. Jerry _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [JDBC] Re: Unable to store SHA hash (Non-HTML--Sorry)
In my code where I need to store short pieces of binary data (like digests) I encode them in hex and store the hex. Yes this results in a 2 times increase in storage, and some overhead in encoding/decodeing, but it isn't too bad. Sure you could use other encodings for the binary data, but I find hex to be the easiest for small amounts of data. We use base64 which converts every 3 characters into 4 (as I recall) for such short things. For longer, type oid in sql works with setBytes()/getBytes() in JDBC2, but what the overhead is for a small amount of binary data I don't know. David ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
[JDBC] How to encode and decode a string as a password field in pgsql table?
hi all How to encrypt and decrypt a value which is kept as a password in a table. In mysql we r having encode and decode ... but in pgsql how to do this using Java. regards Shiva. -- Subhramanya Shiva, Programmer Archean InfoTech pvt.Ltd. Hyderabad, India http://www.archeanit.com ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly