Netbeans和mysql通信(Netbeans and mysql communication)
我为我们公司创建了一个应用程序。 起初,我试图在我的MySQL-xampp数据库中创建没有密码,它工作正常。 现在我的问题是我在我的数据库上放了一个密码,我的应用程序现在每次登录时都会抛出这个错误:
SQL java.sql.SQLException:对用户'root'@'CITSP-MOB7'的访问被拒绝(使用密码:YES)
连接我的数据库时出错:
无法连接。 无法使用com.mysql.jdbc.Driver建立与jdbc:mysql // localhost:3306 / mydb的连接(对用户'root'@'CITSP-MOB7'(使用密码:YES)拒绝访问)。
这是我的数据库连接代码:
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; static final String DB_URL = "jdbc:mysql://192.168.1.112:3306/citsp"; static final String USER = "root"; static final String PASS = "mypassword"; try{ Class.forName("com.mysql.jdbc.Driver"); }catch(ClassNotFoundException ex){ } //STEP 3: Open a connection System.out.println("Connecting to database..."); conn = DriverManager.getConnection(DB_URL,USER,PASS); //STEP 4: Execute a query System.out.println("Creating statement..."); stmt = conn.createStatement();
有人可以帮我解决我的连接问题吗? 您的回答将不胜感激。 提前致谢! :)
I've created an application for our company. At first, I've tried to create without password on my database in MySQL-xampp and it works fine. Now my problem is I put a password on my database and my application is now throwing me this error whenever I log in:
SQL java.sql.SQLException: Access denied for user 'root'@'CITSP-MOB7'(using password: YES)
I also get an error connecting my database:
Unable to connect. Cannot establish a connection to jdbc:mysql//localhost:3306/mydb using com.mysql.jdbc.Driver (Access denied for user 'root'@'CITSP-MOB7' (using password: YES)).
Here is my code for database connection:
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; static final String DB_URL = "jdbc:mysql://192.168.1.112:3306/citsp"; static final String USER = "root"; static final String PASS = "mypassword"; try{ Class.forName("com.mysql.jdbc.Driver"); }catch(ClassNotFoundException ex){ } //STEP 3: Open a connection System.out.println("Connecting to database..."); conn = DriverManager.getConnection(DB_URL,USER,PASS); //STEP 4: Execute a query System.out.println("Creating statement..."); stmt = conn.createStatement();
Can somebody help me to solve my connection problem? Your answer will be appreciated. Thanks in advance! :)
原文:https://stackoverflow.com/questions/29787434
相关问答
更多-
我认为这是URLLoader类中的一个错误。 如果你看到错误信息(至少我得到的那个,你没有粘贴yorrs!)你会看到它: 错误:错误#2029:此URLStream对象没有在flash.net::URLLoader/onComplete()上的flash.net::URLStream/readBytes()打开的流: 这可以让您了解正在发生的事情。 URLLoader类在内部使用URLStream对象,该对象提供对下载数据的低级访问。 该错误消息表明正在URLLoader上调用onComplete处理程序。 ...
-
我们决定使用tomcat阀门来加载图像,阀门充当从https域加载图像的代理。 We have decided to use tomcat valves for loading the images, valves act as a proxy for loading the images from https domains.
-
首先,由于load方法是异步的,因此代码中的这三个调用将相继覆盖。 唯一会导致COMPLETE事件被调度的调用将是最后一个调用。 如果要异步加载文件,则需要为每个文件创建一个URLLoader实例。 其次,(更重要的是你的问题) URLLoader类中没有属性允许你访问load()最初被调用的URLRequest 。 一个简单的方法是扩展URLLoader 。 例如,如果你只需要网址: public class MyURLLoader extends URLLoader { private var ...
-
由于您使用AIR从文件系统加载数据,因此您不必异步执行此操作。 您可以像这样同步加载它: function readTxtList(url:String):Array { var file:File = File.documentsDirectory.resolvePath(url); var fileStream:FileStream = new FileStream(); fileStream.open(file, FileMode.READ); var text:Str ...
-
我想到的三件事可能导致这种情况: 确保您正在捕获SecurityError.SECURITY_ERROR和IOError.IO_ERROR 。 如果发生错误,则不会引发COMPLETE事件。 如果未将Loader添加到UI树,则无法使用。 如果是这种情况,您应该使用URLLoader 。 如果要使用addEventListener添加事件侦听器,请确保未使用弱引用。 如果你是,并且没有扎根,他们可能被垃圾收集,这将导致你的症状。 Three things come to mind that could ca ...
-
AMF作为REST格式,使用BlazeDS和AS3的URLLoader(AMF as a REST format, using BlazeDS and AS3's URLLoader)[2023-05-07]
我之前做过那个..你可以从这里查看我的博客文章,也许它可以帮助你。 我在服务器端使用Java,而不是CF. I did that a some time ago..you can check my blog post from here, maybe it can help you. I was using Java on the server side, not CF. -
实际上,在发布此问题后,我认为它可能由URLRequest而不是URLLoader处理。 它是: URLRequest.manageCookies 那么,回答我自己的问题: 是的,它是自动管理它们。 是的,它可以通过适当命名的manageCookies属性进行管理。 Actually, just after posting this question I thought that it may be handled by URLRequest and not URLLoader. It is: URLReq ...
-
URLLoader不会从URLRequest加载数据。(URLLoader doesn't load data from URLRequest. No error messages)[2021-12-12]
我认为只是你的Main类应该从MovieClip延伸而不是Sprite : public class Main extends MovieClip { // ... } 要在浏览器中调试项目,您可以使用可从此处下载的Flash播放器调试版本。 希望能有所帮助。 I think that simply your Main class should extend from MovieClip and not Sprite : public class Main extends MovieClip ... -
是的,URLLoader缓存请求,并且有各种解决方案来中断缓存请求(通常通过在Web请求的末尾添加随机元素)。 您可以在此处查看返回的URLRequest对象的文档 ,以及各种缓存选项。 但是,我建议在收到请求并使用您所在的平台数据库/数据存储模式后在本地保留数据。 然后,在发出请求之前检查Internet:如果可以建立连接,请发出请求以检索和更新本地数据。 如果没有互联网/连接,只需加载您在本地保存的数据。 使用请求的“缓存”版本不是值得信赖的模式。 Yes, the URLLoader caches r ...
-
Flash无法很好地处理HTTP状态代码。 这是一篇博客文章,其中包含Adobe员工的评论,称该问题实际上是插件限制。 Adobe员工指向一个库,用于通过套接字使用AS3执行HTTP请求,但我怀疑这将是非常高效的(与将插件手动请求关闭到浏览器相比)。 我曾经做过的所有项目的标准做法是始终发送200 OK并在消息上添加error密钥。 编辑:也看到这个错误 ,这正是你的问题。 Flash does not handle HTTP status codes very well. Here is a blog p ...