Is there a method to select and execute a query on all columns in the database that match a specific name using UCANACESS
I've attempted using methods for MYSQL found at Find all tables that have X column name
String sql = "SELECT DISTINCT table_name FROM INFORMATION_SCHEMA.COLUMNS WHERE column_name= 'CID'";
ResultSet rs = readID.executeQuery(sql);
System.out.println("This plugin has successfully connected to the database...");
do {
userInput2 = JOptionPane.showInputDialog(null,"HIPAA Main Menu \n1. Encrypt the database. \n2. Decrypt the database.\n3. Exit the program.\n(Make a selection by entering 1, 2, or 3)");
choice = Integer.parseInt(userInput2);
switch (choice) {
case 1 :
while (rs.next()) {
ID = rs.getString("CID");
rs.updateString("CID", encodedID(ID,aesKey,cipher));
rs.updateRow();
x++;
}
dbConnection.commit();
ResultSet rs = readID.executeQuery(sql);
I expect the code to connect to any column named CID in the database and then get the strings within the column but instead, I receive the following error...
This plugin has successfully connected to the database... net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.4 Column not found: CID at net.ucanaccess.jdbc.UcanaccessResultSet.getString(UcanaccessResultSet.java:782) at Hipaa.main(Hipaa.java:63) Caused by: net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.4 Column not found: CID at net.ucanaccess.jdbc.UcanaccessResultSet.getObject(UcanaccessResultSet.java:649) at net.ucanaccess.jdbc.UcanaccessResultSet.getString(UcanaccessResultSet.java:776) ... 1 more
Try to change this line as :
String sql = "SELECT DISTINCT table_name FROM INFORMATION_SCHEMA.COLUMNS WHERE column_name= 'CID'";
And try to run it again Hope this will work
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.