Results 1 to 2 of 2
- 04-16-2010, 09:11 AM #1
Member
- Join Date
- Apr 2010
- Posts
- 2
- Rep Power
- 0
String.contains works in jdk 6, not in 1.4.2
The below snippet (swiped from Programming tutorials and source code examples) compiles and runs in jdk 6, but throws an exception in jdk 1.4.2 ( I have to make a jre 1.5 compatible executable, and only have access to the two different jdk's at present)
The error is:Java Code:. . . Class.forName ("oracle.jdbc.OracleDriver"); // Enable logging // DriverManager.setLogStream(System.err); System.out.println("Getting Connection"); Connection conn = DriverManager.getConnection ( "jdbc:oracle:thin:@192.168.0.77:1521:dbname", "user", "passwd"); // Any warnings generated by the connect? checkForWarning(conn.getWarnings()); System.out.println("Creating Statement"); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM TABLE_NAME"); System.out.println("Retrieving Results"); int i = 0; while (rs.next()) { System.out.println("Retrieving ID"); int iID = rs.getInt("ID"); System.out.println("Retrieving Name"); String sName = rs.getString("NAME"); if (sName.contains("XXXXX")){ System.out.println("Found XXXXX"); } System.out.println(sName); //System.out.println("ROW " + ++i + ": " + iID + "; " + sName + "; " + "."); } . . .
For the life of me, I cannot see any difference in the String.contains and ResultSet.GetString methods in 1.4.2 and 6 API docs, so I'm just giving up on RTFM and STFW and am going to break down and ask just what the heck I'm doing wrong?Java Code:DBConnectionTest.java:58: cannot resolve symbol symbol : method contains (java.lang.String) location: class java.lang.String if (sName.contains("XXXXX")){
Again, the code compiles and runs in java 6, but chokes in 1.4.2. The two different jdks are on two different systems. jdk 6 is on a Windows XP workstation, and the 1.4.2 jdk is on a Linux server.
Thanks,
ScottLast edited by ScottThornley; 04-16-2010 at 10:54 AM. Reason: completeness
- 04-16-2010, 03:04 PM #2
Senior Member
- Join Date
- Mar 2010
- Posts
- 266
- Rep Power
- 4
Similar Threads
-
one works, mine doesn't
By psychop in forum Java AppletsReplies: 0Last Post: 01-25-2010, 11:36 PM -
Custom renderer (almost works)
By geforce2000 in forum AWT / SwingReplies: 11Last Post: 12-13-2009, 09:15 PM -
Anyone know how GroupLayout works?
By ProgrammingPup in forum Advanced JavaReplies: 5Last Post: 12-01-2009, 11:12 PM -
Javascript works in firefox not IE
By bghwebmaster in forum Advanced JavaReplies: 5Last Post: 09-29-2009, 01:15 PM -
sound works then stops!
By smileii in forum CLDC and MIDPReplies: 0Last Post: 09-26-2009, 12:06 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks