java - How do can I duplicate a MySql database with JDBC
问题描述
I'm trying to create a chat app in Java and I've hit a road bump. I want there to be multiple chat rooms, and those chat rooms can contain multiple people. I feel like to do this by code, every time a user creates a chatroom, it should create a new database and use that. What I want to do is just have a template database, and then duplicate it with different names. I know there might be security issues like setting the users allowed to access it, but I have no idea on what else I could do. For further explanation, the server I'm using is not local host, it is in a remote location so I can't just simply send a command with terminal.
This is the code I used to do what I wanted, but with a table instead of an entire database. Hopefully it might give you some more info on what I want/need.
int updateTable = st.executeUpdate("CREATE TABLE chat_room_" + df.format(num) + " LIKE chat_room_temp");
解决方案
推荐阅读
- apache-nifi - Nifi进程组调度使用control m
- javascript - 构建简单的网络应用程序时,Firebase UI 无法显示在按钮中
- discord - Discord.js 将使用命令的内容发送给管理员
- javascript - 类型错误:_fire__WEBPACK_IMPORTED_MODULE_1__.default.auth 不是函数
- bison - 为什么 Bison 总是输出大于号?如何省略它?
- python - Issue with reproducibility across different sessions
- azure - Registration only site with custom policy
- vue.js - 是否可以在路线内编写一些代码?
- gradient - 有没有一个lightgbm函数起到staged_decision_function的作用,类似于xgboost?
- android - 如何使用工作管理器来保持广播接收器的活动?