rasanya resource bundle bukan kegunaan yg tepat dalam hal ini. gunakan resource yg tidak locale aware untuk keperluan ini.
tapi salah satu work around-nya, coba namanya diganti SelectResource_en_US.properties On 10 February 2010 00:59, satria ardi <my_frien...@yahoo.co.id> wrote: > > > Saya punya source code untuk membuat koneksi java secara dinamis sbg > berikut > > File SelectResource.properties untuk mengatur koneksi > > Driver=com.mysql.jdbc.Driver > URL=jdbc:msql://192.168.123.2/Alamat > > Connect.java > > import java.sql.*; > import java.util.*; > import java.sql.Connection; > import java.sql.DriverManager; > import java.sql.SQLException; > import java.util.logging.Level; > import java.util.logging.Logger; > > > public class Connect { > public static void main(String argv[]) { > Connection con = null; > ResourceBundle bundle = > ResourceBundle.getBundle("SelectResource");//MEMANGGIL .PROPERTIES > > try { > String url = bundle.getString("URL");//dari .properties > Statement stmt; > ResultSet rs; > try { > Class.forName("com.mysql.jdbc.Driver"); > } catch (ClassNotFoundException ex) { > Logger.getLogger(Connect.class.getName()).log(Level.SEVERE, > null, ex); > } > // here is where the connection is made > con = DriverManager.getConnection(url, "kargo", "invoice"); > } > catch( SQLException e ) { > e.printStackTrace(); > } > finally { > if( con != null ) { > try { con.close(); > System.out.println("dada"); > } > catch( Exception e ) { } > } > } > } > } > > Ketika di compile muncul error sebagai berikut: > > init: > deps-module-jar: > deps-ear-jar: > deps-jar: > compile-single: > run-main: > Exception in thread "main" java.util.MissingResourceException: Can't find > bundle for base name SelectResource, locale en_US > at > java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1521) > at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1260) > at java.util.ResourceBundle.getBundle(ResourceBundle.java:715) > at Connect.main(Connect.java:21) > Java Result: 1 > BUILD SUCCESSFUL (total time: 0 seconds) > > > > Kira - kira kenapa ? > > > > > ------------------------------ > Mencari semua teman di Yahoo! Messenger? > <http://sg.rd.yahoo.com/id/messenger/trueswitch/mailtagline/*http://id.messenger.yahoo.com/invite/> > Undang teman dari Hotmail, Gmail ke Yahoo! Messenger dengan mudah sekarang! > > > -- -o--o---( ^ ^ )---o--o- Speed Optimization: Seek and ye shall find! In case it isn't in the cache yet, too bad, you've to wait 40x longer. Daniel Baktiar (http://dbaktiar.wordpress.com)