当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 1 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : java问题 (急用)User Authentication failed.
帖子发表于 : 2006-10-16 13:56 

注册: 2006-07-20 15:44
帖子: 26
送出感谢: 0 次
接收感谢: 0 次
At first I made sure I had mckoidb.jar in the path and not both mckjdbc.jar and mckoidb.jar.
The first thing I did was create the database from within my create schema program. This worked fine..
by using a URL with ?create=true option.

After the database was created, the create schema program exited. Now I have another Java program (say prog2) that is trying to
access the new schema created. I get the Journal file already exists problem. After looking for where I was making a mistake,
I tried to eliminate in-advertant starting of the database by removing all mckoi jar files from the path
and including the com.mckoi.* code in my project. So, I created the database again with mckoi code compiled into my project.
Now if I try to run my other program I see the same problem. Obviously I am starting another program somewhere... that I do not
know of.

To test and see if I get the same problem while running the database outside the IDE, I ran the following commands

> java -jar lib\mckoidb.jar -conf conf\db.conf
Mckoi SQL Database ( 1.0.2 )
Copyright (C) 2000, 2001, 2002, 2003 Diehl and Associates, Inc. All rights reserved.
Use: -h for help.

Mckoi SQL Database comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See LICENSE.txt for details of the
GPL License.

TCP JDBC Server (multi_threaded) on port: 9157.
Boot time: 1094ms.


and the query tool as follows

>java -cp lib\mckoidb.jar com.mckoi.tools.JDBCQueryTool -conf conf\db.conf -u "mw" -p "osx"
Using JDBC Driver: com.mckoi.JDBCDriver
com.mckoi.database.jdbc.SQLLoginException: User Authentication failed.
at com.mckoi.database.jdbc.RemoteDatabaseInterface.login(RemoteDatabaseInterface.java:170)
at com.mckoi.database.jdbc.MConnection.login(MConnection.java:295)
at com.mckoi.database.jdbc.MConnection.login(MConnection.java:341)
at com.mckoi.database.jdbc.MDriver.connect(MDriver.java:600)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.mckoi.tools.JDBCQueryTool.main(JDBCQueryTool.java:357)

This is very puzzling since I created the database using the above userId and password. How do we get around this problem? Is there a master userId other than what we use to
create the database that we can use to see what values are stored in the database? When I step through the code, in the method com.mckoi.database.Database::authenticateUser
the select returns nothing, even though I used mw/osx to create the database. I am curious why?

Did I make any sense?

thanks

上面的是我在网上搜的 ,他的问题跟我的差不多
我执行完 java -jar Testdb.jar如下
我最想知道的是
com.mckoi.database.jdbc.SQLLoginException: User Authentication failed.
at com.mckoi.database.jdbc.RemoteDatabaseInterface.login(RemoteDatabaseInterface.java:170)
at com.mckoi.database.jdbc.MConnection.login(MConnection.java:295)
at com.mckoi.database.jdbc.MConnection.login(MConnection.java:341)
at com.mckoi.database.jdbc.MDriver.connect(MDriver.java:600)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at TestDB.getConnection(Main.java:47)
at TestDB.runTest(Main.java:21)
at TestDB.main(Main.java:7)
这是什么原因引起的
其中源程序 如下
import java.sql.*;

import java.io.*;

import java.util.*;

class TestDB

{public static void main (String args[])

{try

{runTest();

}

catch (SQLException ex)

{while (ex !=null)

{ex.printStackTrace();

ex=ex.getNextException();

}

}

catch (IOException ex)

{ex.printStackTrace();

}

}

public static void runTest()

throws SQLException,IOException

{Connection conn=getConnection();

try

{Statement stat=conn.createStatement();

stat.execute("CREATE TABLE Greetings (Message CHAR(20))");

stat.execute("INSERT INTO Greetings VALUES ('hello,world:')");

ResultSet result=stat.executeQuery("SELECT * FROM Greetings");

result.next();

System.out.println(result.getString(1));

stat.execute("DROP TABLE Greetings");

}

finally

{conn.close();

}

}

public static Connection getConnection()

throws SQLException,IOException

{Properties props = new Properties();

FileInputStream in = new FileInputStream("database.properties");

props.load(in);

in.close();

String drivers=props.getProperty("jdbc.drivers");

if (drivers !=null)

System.setProperty("jdbc.drivers",drivers);

String url=props.getProperty("jdbc.url");

String username=props.getProperty("jdbc.username");

String password=props.getProperty("jdbc.password");

return DriverManager.getConnection(url,username,password);

}

}


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 1 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 4 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译