Tag Info

New answers tagged

0

The bad news: Prepared statements do not work like that. Parameters can only be data, not code or identifiers. The good news: you do not need parameters for a ALTER TABLE statement at all. final String sqlps = "ALTER TABLE filen ADD COLUMN gn_id integer"; ... ps = con.prepareStatement(sqlps); ps.execute(); Your column needs a data type. I added ...


0

You can't use ? parameters for identifiers. This is common across database brands. Use format() , like this: text sql = format('ALTER TABLE %I ADD COLUMN %I', table_name, column_name); %I means identifier. It will use identifier rules when substituting values for %I. For added security you can whitelist characters and identifier names and throw an ...


0

[Solved] How to fix: 'inventoryitems', 'CREATE TABLE `inventoryitems` ( `inventoryitemid` int(10) unsigned NOT NULL AUTO_INCREMENT, `type` tinyint(3) unsigned NOT NULL, `characterid` int(11) DEFAULT NULL, `accountid` int(11) DEFAULT NULL, `itemid` int(11) NOT NULL DEFAULT '0', `inventorytype` int(11) NOT NULL DEFAULT '0', `position` int(11) ...


2

The problem is that you forgot to put double quotes around the -e parameter String cmd = mysql + " --user=" + username + " --password=" + password + " -e\"" + "source " + restoreFile + "\""; An alternative would be to redirect the file into the mysql client String cmd = mysql + " --user=" + username + " --password=" + password + " < " + ...


1

The system is starting to complain about the number of comments. I'd be interested in seeing the statements as they are sent to the server - i.e. the fully generated SQL statements, i.e. with real values, not ? parameter place holders. The statement that appears to be causing the issue is this one. INSERT INTO `inventoryitems` VALUES (DEFAULT, 4, '595', ...



Top 50 recent answers are included