NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Displaying a table from my database using database explore tutorial.

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
sama
Posted via mailing list.





PostPosted: Tue Mar 15, 2011 3:41 pm    Post subject: Displaying a table from my database using database explore tutorial. Reply with quote

In the tutorial it display the table and the related columns only I want to
display the whole table ( columns and rows).
I changed the createSceneFromConnection to this but it gave me error.any
help??

private void createSceneFromConnection(Connection jdbcConnection) throws
SQLException {
ArrayList< ArrayList> tables = new ArrayList< ArrayList>();
DatabaseMetaData databaseMetaData = jdbcConnection.getMetaData();
String[] names = {"TABLE"};
ResultSet resultSet = databaseMetaData.getTables(null, "%", "%",
names);
while (resultSet.next()) {
String table = resultSet.getString("TABLE_NAME");
tables.get(edgeID).add(table);
createNode(this, (int) (Math.random() * 800), (int)
(Math.random() * 800), IMAGE_LIST, table, "Table", null);
ResultSet columns =
jdbcConnection.getMetaData().getColumns(null, null, table.toUpperCase(),
"%");
while (columns.next()) {
String columnName = columns.getString("COLUMN_NAME");
tables.get(edgeID).add(columnName);
createNode(this, (int) (Math.random() * 800), (int)
(Math.random() * 800), IMAGE_LIST, columnName, null, null);
// createPin(this, table, table + ":" + columnName,
IMAGE_ITEM, columnName, columnName);
ResultSet rows = jdbcConnection.createStatement(edgeID,
edgeID, edgeID).executeQuery(columnName);
while (rows.next()) {
String rowelment= rows.getNString(edgeID);
tables.get(edgeID).add(rowelment);
createPin(this, table, table + ":" + rowelment, IMAGE_ITEM,
rowelment, rowelment);
}
}
}
for (ArrayList string : tables) {
ResultSet resultSet1 = databaseMetaData.getExportedKeys(null,
null, null);
while (resultSet1.next()) {
String pkTable = resultSet1.getString("PKTABLE_NAME");
String pkColumn = resultSet1.getString("PKCOLUMN_NAME");
String fkTable = resultSet1.getString("FKTABLE_NAME");
String fkColumn = resultSet1.getString("FKCOLUMN_NAME");
createEdge(this, fkTable + ":" + fkColumn, pkTable + ":" +
pkColumn);
}
}
this.moveTo(null);
}


--
View this message in context: http://netbeans-org.1045718.n5.nabble.com/Displaying-a-table-from-my-database-using-database-explore-tutorial-tp3706716p3706716.html
Sent from the Netbeans IDE Users mailing list archive at Nabble.com.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo