MrsQ's Profile
Reputation: 2
Apprentice
- Group:
- Members
- Active Posts:
- 29 (0.02 per day)
- Joined:
- 20-September 08
- Profile Views:
- 845
- Last Active:
Apr 24 2013 07:04 PM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Latest Visitors
-
IronRazer 
27 Mar 2013 - 21:36 -
CodingSup3rna... 
25 Mar 2013 - 08:06 -
Martyr2 
14 May 2012 - 09:43 -
DimitriV 
02 May 2012 - 22:47 -
macosxnerd101 
02 May 2012 - 21:13
Posts I've Made
-
In Topic: Problem sending SelectedValue of combobox to object property
Posted 25 Mar 2013
CharlieMay, on 25 March 2013 - 05:37 AM, said:At a quick glance it appears that you're just inserting strings of fruit names into the combobox.
Are you sure you're not wanting .SelectedItem or .Text instead?
That was exactly the problem! I changed it to .SelectedItem and it works perfectly. Thank you so much for taking the time to help! -
In Topic: JList does not always load or loads incomplete
Posted 13 May 2012
I figured it out -apparently I needed to instantiate the DBAccessObjects before I assembled the panels. I changed that and it's working every time now!
Happy Days!!!
Thank you so much for helping me to work through this! -
In Topic: JList does not always load or loads incomplete
Posted 13 May 2012
Martyr2, on 13 May 2012 - 03:15 PM, said:Look in your status window for an error message. Your code ran fine for me after I connected it to an Access database for a quick test. No problems at all with the lists.
You may see an error message along the lines of
TestDBAccess Error: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Which means it tripped one of your error handlers and is showing a Database error. This error is because I don't have the setup DSN... which makes sense. However, since it was handled it will still show your application. Look for an error message in your status window. It won't likely be the same error message but you might be getting one and you simply don't know it.

I just ran it a couple dozen times and no such error... right about now, I'd be happy to see any error message! -
In Topic: JList does not always load or loads incomplete
Posted 13 May 2012
Martyr2, on 13 May 2012 - 02:16 PM, said:Can you provide us the code for your DBAccessObject class?
Here it is ... and thank you for help!
import java.sql.*; public class DBAccessObject { private Connection conClient; private Statement stmtClient; private ResultSetMetaData rsMetaData; /** * This constructor is the default to link to the Database. * @param None. * @exception SQLException On SQL Errors. * @exception ClassNotFoundException On dynamic load failure of DriverManager class. */ public DBAccessObject() throws SQLException, ClassNotFoundException { ConnectToDB("jdbc:odbc:JavaClassDSN"); } // End DBAccessObject() /** * This constructor will connect to the Database with supplied URL link. * @param String to represent the URL of the database. * @exception SQLException On SQL Errors. * @exception ClassNotFoundException On dynamic load failure of DriverManager class. */ public DBAccessObject(String sURL) throws SQLException, ClassNotFoundException { ConnectToDB(sURL); } // End DBAccessObject(String sURL) // This method is private so JavaDoc tags are not used, because it is encapsuated. private void ConnectToDB(String sURL) throws SQLException, ClassNotFoundException { // (1) Register the jdbc/odbc DSN with the DriverManager: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // (2) Create a Connection and Statement objects to communicate // with the Database. JavaClassDSN: Is the name that was // used in creating the ODBC Data Source Name in windows. You // do this by Settings/Control Panel/ODBC Administrator. conClient = DriverManager.getConnection(sURL); stmtClient = conClient.createStatement(); } // End ConnectToDB /** * This method will execute a SELECT statement and returns the ResultSet object. * @param String to represent the SELECT statement to be executed. Do not send in DML statements * @return A ResultSet object that contains the results of the passed in SELECT statement. * @exception SQLException On SQL Errors. * @see The SQL package for more information. */ public ResultSet getResultSet(String sSQL) throws SQLException { ResultSet rsTemp; rsTemp = stmtClient.executeQuery(sSQL); rsMetaData = rsTemp.getMetaData(); return rsTemp; } // End getResultSet /** * This method will return the MetaData for the last executed SELECT statement. * @param None. * @return A ResultSetMetaData object that contains the results of the passed in SELECT statement. */ public ResultSetMetaData getResultMetaData() { return rsMetaData; } // End getResultMetaData /** * This method will return the ResultSetMetaData for the passed in Table Name in the Database. * @param String to represent the Table Name. * @return A ResultSetMetaData object that contains the results of the passed in Table Name. * @exception SQLException On SQL Errors. */ public ResultSetMetaData getResultMetaData(String sTableName) throws SQLException { // This method will return the MetaData for the passed table name: return stmtClient.executeQuery("SELECT * FROM " + sTableName).getMetaData(); // Note: The line of code above could be replaced by these two lines: // ResultSet rsTableInfo = stmtClient.executeQuery("SELECT * FROM " + sTableName); // return rsTableInfo.getMetaData(); } // End getResultMetaData(String sTableName) /** * This method will execute any non SELECT SQL statement. It should be used for DML or DDL statements. * @param String to represent the SQL statement. * @return To indicate the number of rows affected by the SQL statement. Mostly for Insert, Update or Delete. * @exception SQLException On SQL Errors. */ public int executeSQL(String sSQL) throws SQLException { return stmtClient.executeUpdate(sSQL); } // End executeSQL /** * This method will return a ResultSet of all Tables in a Database. * @param None. * @return ResultSet of the Table names. * @exception SQLException On SQL Errors. */ public ResultSet getDatabaseTableNames() throws SQLException { ResultSet rsTemp; DatabaseMetaData dbMetaData = conClient.getMetaData(); String[] sTables = {"TABLE"}; return dbMetaData.getTables(null, null, "%", sTables); } /** * This method will close down the Statement and Connection objects. * @param None. * @return None. * @exception SQLException On SQL Errors. */ public void closeDown() throws SQLException { stmtClient.close(); conClient.close(); } // End closeDown } // End Class DBAccessObject -
In Topic: JList does not always load or loads incomplete
Posted 13 May 2012
MrsQ, on 13 May 2012 - 01:23 PM, said:Okay, took a look at my scrollingPanels and I had one as private JScrollPane scrollingTables; instead of private JScrollPane scrollingTablesNames;
I fixed that, and now tables do no load at all (tried about 15 times in a row, all came up blank).
Scratch that, I removed that along with the other scrolling pane declarations as they were all just taking up valuable real estate. Unfortunately, none of that has anything to do with the JLists not loading properly
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Private
Friends
MrsQ hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
MrsQ has no profile comments yet. Why not say hello?