• Subject: RE: Problem using SQL where library contains a period
  • From: Buck Calabro <buck.calabro@xxxxxxxxxxxxxxxxx>
  • Date: Fri, 12 Jan 2001 13:48:09 -0500

Use double quotes around the library name.  This is also used when you have
a library, table or column named the same as a reserved word, like select
"GROUP" from custfile...

Buck Calabro
Aptis; Albany, NY
"Nothing is so firmly believed as
 that which we least know" -- Michel Montaigne
Visit the Midrange archives at http://www.midrange.com

> -----Original Message-----
> From: Lee Bircham 
> Sent: Friday, January 12, 2001 7:27 AM
> To:   'JAVA400-L@midrange.com'
> Subject:      Problem using SQL where library contains a period
> Hi, 
> I have a problem when using JDBC and SQL to access my AS400 database. The
> problem happens when there is a period in the library name. Eg Library
> TRK1.5B
> An extract of my java code is as follows: 
> // Register Native JDBC Driver and connect to local DB. 
> Class.forName("com.ibm.db2.jdbc.app.DB2Driver"); 
> Connection c = DriverManager.getConnection("jdbc:db2:*local"); 
> // Run an SQL query on the table. 
> Statement s = c.createStatement(); 
> ResultSet rs = s.executeQuery("SELECT * FROM TRK1.5B.T2USERP ORDER BY
> SRUSER"); 
> When this is run I get the following error message:
> java.sql.SQLException: Numeric constant .5B not valid.? 
> This is because there is a period in the library name and SQL doesn't like
> If I change the library name to another that has no period eg TRKTEST the
> java program works fine.   
> Any ideas apart from changing the library name on getting round this? 
> Thanks, 
> Lee. 
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.