Hello to everyone. This is my first post so I apologize if it's in the wrong section or if my question has already been answered.
I've installed DB2 Express Edition on my computer (running Windows 7) and created my database. When I installed DB2, I chose to use my local account as administrator (so I use the username I have in Windows and don't have a password, since I've chosen not to have one in my Windows account).
My problem is that I can't access my database with Java (I use JCreator LE 5.00 as my IDE). It seems that it can't login with the username I provide. Here is my code:
Code:
String url = "jdbc:db2://localhost:50000/DBName";
Connection con;
try
{
Class.forName("com.ibm.db2.jcc.DB2Driver");
}
catch (java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con = DriverManager.getConnection(url, "userName", "");
}
catch (SQLException e) {
System.err.println("SQLException "+e.getMessage());
}
The problem is in the bold line. The output says:
Quote:
|
SQLException [jcc] [t4] [10107] [11233] [3.50.152] The length of the password, 0, is not allowed. ErrorCode =- 4461, SQLSTATE = 42815
|
When I try not to insert my username and password, so the bold line becomes like this:
Code:
con = DriverManager.getConnection(url);
I get the following message:
Quote:
|
SQLException [jcc] [t4] [10205] [11234] [3.50.152] Null userid is not supported. ErrorCode =- 4461, SQLSTATE = 42815
|
So, from what I understand, I have to insert a password, but I don't have any, since I don't use a password in my Windows account.
Could anyone help me? Thanks in advance!
