Rrugemalira
asked on
JDBC: SQLException: No suitable driver; SQLState: 08001 VendorError: 0
SQLException: No suitable driver
SQLState: 08001
VendorError: 0
1. I have /usr/local/mysql-connector -java-3.1. 6/mysql-co nnector-ja va-3.1.6-b in.jar
2. The userconfig.sh file is in /usr/local/j2sdkee1.3.1/bi n
3. userconfig.sh contains these lines:
J2EE_CLASSPATH=/usr/local/ mysql-conn ector-java -3.1.6/com /mysql/jdb c:/usr/loc al/mysql-c onnector-j ava-3.1.6/ mysql-conn ector-java -3.1.6-bin .jar
export J2EE_CLASSPATH
JAVA_HOME="/opt/j2sdk1.4.2 _04
export JAVA_HOME
4. The culprit code segment is as follows:
Connection conn = DriverManager.getConnectio n(
"jdbc:/usr/local/mysql/bin ://localho st/rtpmKen yaDB","rru gemalira", "Nahum7");
How do I solve this? Kindly instruct.
SQLState: 08001
VendorError: 0
1. I have /usr/local/mysql-connector
2. The userconfig.sh file is in /usr/local/j2sdkee1.3.1/bi
3. userconfig.sh contains these lines:
J2EE_CLASSPATH=/usr/local/
export J2EE_CLASSPATH
JAVA_HOME="/opt/j2sdk1.4.2
export JAVA_HOME
4. The culprit code segment is as follows:
Connection conn = DriverManager.getConnectio
"jdbc:/usr/local/mysql/bin
How do I solve this? Kindly instruct.
copy the jar to <webapp>/WEB-INF/lib
> "jdbc:/usr/local/mysql/bin ://localho st/rtpmKen yaDB","rru gemalira", "Nahum7");
and change connect string to:
"jdbc:mysql://localhost/rt pmKenyaDB" ,"rrugemal ira", "Nahum7");
and change connect string to:
"jdbc:mysql://localhost/rt
ASKER
I do have mysql-connector-java-3.1.6 -bin.jar in WEB-INF/lib
did u change the connect string?
ASKER
I've also changed "jdbc:/usr/local/mysql/bin ://localho st/rtpmKen yaDB","rru gemalira", "Nahum7");
to "jdbc:mysql://localhost/rt pmKenyaDB" ,"rrugemal ira", "Nahum7");
AND NOW THE ERROR READS:
SQLException: Access denied for user 'rrugemalira'@'localhost.l ocaldomain ' (using password: YES)
SQLState: 28000
VendorError: 1045
to "jdbc:mysql://localhost/rt
AND NOW THE ERROR READS:
SQLException: Access denied for user 'rrugemalira'@'localhost.l
SQLState: 28000
VendorError: 1045
Looks like you don't have rights to login with that user/password
check the mysql logins.
check the mysql logins.
Have you loaded the driver via the classloader?
e.g.
try{
Class.forName( driver ) ;//here
Connection conn = DriverManager.getConnectio n(
"jdbc:/usr/local/mysql/bin ://localho st/rtpmKen yaDB","rru gemalira", "Nahum7");
stmt = conn.getStatement(........ ..);
}catch (Exception e){
System.out.print("Whoops, buggered") ;
}
e.g.
try{
Class.forName( driver ) ;//here
Connection conn = DriverManager.getConnectio
"jdbc:/usr/local/mysql/bin
stmt = conn.getStatement(........
}catch (Exception e){
System.out.print("Whoops, buggered") ;
}
ASKER
I will summarize:
1. I'm still stuck with the following error:
SQLException: No suitable driver
SQLState: 08001
VendorError: 0
2. Is this userconfig.sh file correct? It resides in /usr/local/j2sdkee1.3.1/bi n
export CLASSPATH="$CLASSPATH:/usr /local/mys ql-connect or-java-3. 1.6/com/my sql/jdbc:/ usr/local/ mysql-conn ector-java -3.1.6/mys ql-connect or-java-3. 1.6-bin.ja r"
JAVA_HOME="/opt/j2sdk1.4.2 _04"
export JAVA_HOME
3. I do have the file mysql-connector-java-3.1.6 -bin.jar in the WEB-INF/lib directory
4. Here is the culprit code:
try {
// Create a session
HttpSession session = request.getSession(true);
// Load the JDBC driver
Class.forName("com.mysql.j dbc.Driver ");
Connection conn = DriverManager.getConnectio n(
"jdbc:/usr/local/mysql/bin ://localho st/rtpmKen yaDB","rru gemalira", "NahumCh7");
I greatly appreciate your kind instruction.
1. I'm still stuck with the following error:
SQLException: No suitable driver
SQLState: 08001
VendorError: 0
2. Is this userconfig.sh file correct? It resides in /usr/local/j2sdkee1.3.1/bi
export CLASSPATH="$CLASSPATH:/usr
JAVA_HOME="/opt/j2sdk1.4.2
export JAVA_HOME
3. I do have the file mysql-connector-java-3.1.6
4. Here is the culprit code:
try {
// Create a session
HttpSession session = request.getSession(true);
// Load the JDBC driver
Class.forName("com.mysql.j
Connection conn = DriverManager.getConnectio
"jdbc:/usr/local/mysql/bin
I greatly appreciate your kind instruction.
Try default port 3306
Connection conn = DriverManager.getConnectio n(
"jdbc:mysql://localhost:33 06/rtpmKen yaDB","rru gemalira", "NahumCh7");
Connection conn = DriverManager.getConnectio
"jdbc:mysql://localhost:33
ASKER
CASE 1
With the proposed fix:
Connection conn = DriverManager.getConnectio n(
"jdbc:mysql://localhost:33 06/rtpmKen yaDB","rru gemalira", "NahumCh7");
I get the following errors:
SQLException: Access denied for user 'rrugemalira'@'localhost.l ocaldomain ' (using password: YES)
SQLState: 28000
VendorError: 1045
CASE 2
With the following code:
Connection conn = DriverManager.getConnectio n(
"jdbc:/usr/local/mysql/bin ://localho st:3306/rt pmKenyaDB" ,"rrugemal ira", "NahumCh7");
I get the following errors:
SQLException: No suitable driver
SQLState: 08001
VendorError: 0
What a vicious circle!
Q1. Does CASE 1 indicate a suitable driver is found but the access is denied?
Q2. Does CASE 2 indicate I have access but no suitable driver?
Q3. Is my userconfig.sh correct?
I'd appreciate any answers to the above questions.
With the proposed fix:
Connection conn = DriverManager.getConnectio
"jdbc:mysql://localhost:33
I get the following errors:
SQLException: Access denied for user 'rrugemalira'@'localhost.l
SQLState: 28000
VendorError: 1045
CASE 2
With the following code:
Connection conn = DriverManager.getConnectio
"jdbc:/usr/local/mysql/bin
I get the following errors:
SQLException: No suitable driver
SQLState: 08001
VendorError: 0
What a vicious circle!
Q1. Does CASE 1 indicate a suitable driver is found but the access is denied?
Q2. Does CASE 2 indicate I have access but no suitable driver?
Q3. Is my userconfig.sh correct?
I'd appreciate any answers to the above questions.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> Try giving access permisssions to 'rrugemalira'@'localhost.l ocaldomain ' using GRANT option in MySQL
I already suggested basically that, plus stated the other problems in your code
I already suggested basically that, plus stated the other problems in your code
ASKER
In my frustration, I understood ( caught on to) "Try giving access permissions to 'rrugemalira@localhost.loc aldomain' using GRANT option in MySQL" - from bloodredsun
than "check the mysql logins" - from objects.
Indee, in hind sight, objects gave me the solution much earlier but, I did not catch on to it! Is it possible to share the points fifty fifty?
I do thank all of you for the kind instruction.
than "check the mysql logins" - from objects.
Indee, in hind sight, objects gave me the solution much earlier but, I did not catch on to it! Is it possible to share the points fifty fifty?
I do thank all of you for the kind instruction.
I'm happy with whatever Rrugemalira decides, be it 50-50 reassign or status quo...