import java.sql.*;
public class one {
public static void main(String[] args)
{
Connection conn=null;
Statement stmt=null;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
conn=DriverManager.getConnection("jdbc:oracle:thin:#//localhost:1521/ecom","system","manager");
stmt=conn.createStatement();
String str="insert into country values(3,'bangladesh');";
int k=stmt.executeUpdate(str);
System.out.println(k);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
The only jar file I added to the class path is ojdbc6.jar is there any other jar required for connecting with oracle 11g(11.2.0.1.0) I am using eclipse as IDE
here are the errors
java.sql.SQLException: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at one.main(one.java:17)
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:359)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:422)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:672)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:237)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
... 7 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocket`Impl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:141)
1) Please be sure database host name, port number, or database instance name are correct.
2) Be sure the TNSListener has been started ( run lsnrctl start)
The connection string is malformed. It should be
"jdbc:oracle:thin://#localhost:1521/ecom"
Notice the transposition of // and #.
Related
I created a simple class to test the communication to my localhost database, that I created with Mysql Workbench. The Mysql Server is running. The JDBC Driver is added to the Classpath of my project.
public class Database
{
public static void main(String[] args)
throws SQLException, ClassNotFoundException
{
Connection connection = null;
String serverName = "localhost:3306";
String databaseName = "detector_tests";
String url = "jdbc:mysql://" + serverName + "/" + databaseName
+ "?useSSL=TRUE";
String username = "simon";
String password = "password123";
connection = DriverManager.getConnection(url, username, password);
}
}
When I run the program I get the followning Exception:
Exception in thread "main"
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications
link failure
The last packet sent successfully to the server was 0 milliseconds
ago. The driver has not received any packets from the server. at
com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:172)
at
com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
at
com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:862)
at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:444)
at
com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:230)
at
com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:226)
at java.sql.DriverManager.getConnection(Unknown Source) at
java.sql.DriverManager.getConnection(Unknown Source) at
Database.main(Database.java:17) Caused by:
com.mysql.cj.exceptions.CJCommunicationsException: Communications link
failure
The last packet sent successfully to the server was 0 milliseconds
ago. The driver has not received any packets from the server. at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source) at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source) at java.lang.reflect.Constructor.newInstance(Unknown Source)
at
com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:59)
at
com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:103)
at
com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:149)
at
com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:165)
at
com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:355)
at
com.mysql.cj.protocol.a.NativeAuthenticationProvider.negotiateSSLConnection(NativeAuthenticationProvider.java:789)
at
com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:499)
at
com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:217)
at
com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1411)
at com.mysql.cj.NativeSession.connect(NativeSession.java:165) at
com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:982)
at
com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:852)
... 6 more Caused by: javax.net.ssl.SSLHandshakeException:
java.security.cert.CertificateException:
java.security.cert.CertPathValidatorException: Path does not chain
with any of the trust anchors at
sun.security.ssl.Alerts.getSSLException(Unknown Source) at
sun.security.ssl.SSLSocketImpl.fatal(Unknown Source) at
sun.security.ssl.Handshaker.fatalSE(Unknown Source) at
sun.security.ssl.Handshaker.fatalSE(Unknown Source) at
sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source) at
sun.security.ssl.Handshaker.process_record(Unknown Source) at
sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) at
sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at
sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at
com.mysql.cj.protocol.ExportControlled.performTlsHandshake(ExportControlled.java:213)
at
com.mysql.cj.protocol.StandardSocketFactory.performTlsHandshake(StandardSocketFactory.java:206)
at
com.mysql.cj.protocol.a.NativeSocketConnection.performTlsHandshake(NativeSocketConnection.java:99)
at
com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:350)
... 13 more Caused by: java.security.cert.CertificateException:
java.security.cert.CertPathValidatorException: Path does not chain
with any of the trust anchors at
com.mysql.cj.protocol.ExportControlled$X509TrustManagerWrapper.checkServerTrusted(ExportControlled.java:280)
at
sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(Unknown
Source) ... 25 more Caused by:
java.security.cert.CertPathValidatorException: Path does not chain
with any of the trust anchors at
sun.security.provider.certpath.PKIXCertPathValidator.validate(Unknown
Source) at
sun.security.provider.certpath.PKIXCertPathValidator.engineValidate(Unknown
Source) at java.security.cert.CertPathValidator.validate(Unknown
Source) at
com.mysql.cj.protocol.ExportControlled$X509TrustManagerWrapper.checkServerTrusted(ExportControlled.java:273)
... 26 more
It appears that I need to add some kind of certificate or something. I m not sure, because I m quite new to databases. Anyone with the same experience or a solution? If you need anymore information I'm happy to edit the post.
Thanks in advance!
Seems you are trying to connect mysql database along with a certificate. If you are connecting to MySQL instance through TLS, you need to have a trust store to keep your certificates. Refer to this document to create MySQL connection along with a TLS connection.
But, you can ignore TLS validation by setting FALSE for "useSSL" in MySQL connection URL. Your code will be as follows.
public class Database
{
public static void main(String[] args)
throws SQLException, ClassNotFoundException
{
Connection connection = null;
String serverName = "localhost:3306";
String databaseName = "detector_tests";
String url = "jdbc:mysql://" + serverName + "/" + databaseName
+ "?useSSL=FALSE";
String username = "simon";
String password = "password123";
connection = DriverManager.getConnection(url, username, password);
}
}
Hope this will be the answer to your question.
as the title, I have a problem with the connection between a Java application and the database created on a virtual machine Cloudera.
A sample project application, which I placed, contains files with the extension .jar needed to connect.
Virtual machine network card is set to Host-Only.
Ip this virtual machine: 192.168.56.1.
I have no idea what to do next in order to be able to perform queries to the database.
Please help and sorry for my English.
Java Code:
package p;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;
import java.util.Scanner;
public class p{
static Connection connection = null;
static Statement statement = null;
public static void main(String[] args) throws SQLException, ClassNotFoundException {
Class.forName("com.cloudera.hive.jdbc4.HS2Driver");
connection = DriverManager.getConnection("jdbc:hive2://192.168.56.1:10000/przychodnia", "cloudera", "cloudera");
statement = connection.createStatement();
System.out.println("Wybierz");
System.out.println("0 aby dodać do istniejącej tabeli wiersz");
System.out.println("1 aby usunąć z istniejącej tabeli wiersz");
String SQL = "SELECT * FROM pacjenci";
ResultSet rs = statement.executeQuery(SQL);
while (rs.next()){
String imie = rs.getString("imie");
String p = imie;
System.out.println(p);
}
}
}
Warnings:
log4j:WARN No appenders could be found for logger (org.apache.thrift.transport.TSaslTransport).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.sql.SQLException: [Simba][HiveJDBCDriver](500310) Invalid operation: java.net.ConnectException: Connection refused: connect;
at com.cloudera.hive.hivecommon.api.HiveServer2ClientFactory.createTransport(HiveServer2ClientFactory.java:224)
at com.cloudera.hive.hive.api.ExtendedHS2Factory.createClient(ExtendedHS2Factory.java:38)
at com.cloudera.hive.hivecommon.core.HiveJDBCConnection.connect(HiveJDBCConnection.java:597)
at com.cloudera.hive.jdbc.common.BaseConnectionFactory.doConnect(BaseConnectionFactory.java:219)
at com.cloudera.hive.jdbc.common.AbstractDriver.connect(AbstractDriver.java:216)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
Caused by: com.cloudera.hive.support.exceptions.GeneralException: [Simba][HiveJDBCDriver](500310) Invalid operation: java.net.ConnectException: Connection refused: connect;
... 7 more
Caused by: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused: connect
at org.apache.thrift.transport.TSocket.open(TSocket.java:185)
at org.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:248)
at org.apache.thrift.transport.TSaslClientTransport.open(TSaslClientTransport.java:37)
at com.cloudera.hive.hivecommon.api.HiveServer2ClientFactory.createTransport(HiveServer2ClientFactory.java:210)
at com.cloudera.hive.hive.api.ExtendedHS2Factory.createClient(ExtendedHS2Factory.java:38)
at com.cloudera.hive.hivecommon.core.HiveJDBCConnection.connect(HiveJDBCConnection.java:597)
at com.cloudera.hive.jdbc.common.BaseConnectionFactory.doConnect(BaseConnectionFactory.java:219)
at com.cloudera.hive.jdbc.common.AbstractDriver.connect(AbstractDriver.java:216)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at p.p.main(p.java:15)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.apache.thrift.transport.TSocket.open(TSocket.java:180)
... 10 more
Ip this virtual machine: 192.168.56.1.
Your image that says "Column name not found" is using IP 192.168.56.101
I'm trying to make a Java program communicate with a MySQL server hosted with A Small Orange. The IP and port they provided me with are 129.121.106.234:3306. The user has been given full permissions to the database, and in my CPanel I've allowed all remote hosts to connect to the MySQL database by adding the access host "%".
I'm using Eclipse, and I've downloaded and added the JDBC driver to the build path.
As near as I can tell, the user I'm trying to use has full permissions to the database, and the MySQL server is open to any request from any IP. I've also tried my admin MySQL credentials, with the same error, so I'm decently confident the issue is with my code. Not absolutely sure though, since I'm not hosting the MySQL server myself.
My code:
package com.package.IPBounce;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class Main {
/**
* #param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
/*
* Isaac the Support Ninja says: The MySQL port is 3306. The IP you use
* is 129.121.106.234.
*/
URL whatismyip;
String IP;
try {
whatismyip = new URL("http://checkip.amazonaws.com");
BufferedReader in = new BufferedReader(new InputStreamReader(
whatismyip.openStream()));
IP = in.readLine();
System.out.println(IP);
Connection con = null;
Statement st = null;
ResultSet rs = null;
//this is just testing code until I get the connection working
String url = "jdbc:mysql://129.121.106.234:3306/db_name";
String user = "user_name";
String password = "small_password";
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection(url, user, password);//error is on this line
st = con.createStatement();
rs = st.executeQuery("SELECT VERSION()");
if (rs.next()) {
System.out.println(rs.getString(1));
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
The error text:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1137)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:356)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2504)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2541)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2323)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:832)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:417)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.package.IPBounce.Main.main(Main.java:39)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:258)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:306)
... 15 more
Edit: I found the solution. My hosting service was blocking the MySQL requests at the firewall. Cleared that up, now it works wonderfully.
The only thing I see as a possible issue is the "newInstance()" call. Try remove that and see if that works.
From:
Class.forName("com.mysql.jdbc.Driver").newInstance();
To:
Class.forName("com.mysql.jdbc.Driver");
This question has been answered here:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Please try the steps in the accepted answer and see if your issue is resolved.
From my experience, I had this issue when my MySql configuration file allowed only localhost access. Replace localhost with the ip address.
i am trying to connect oracle database with my java program using eclipse IDE, i have added JDBC driver ojdbc6.jar into class path.
am using:
Database is: Oracle 11g r1 Enterprise edition.
Operating system: windows 7 64bit.
JDK version: 1.7.0.
i have tested in browser with url as "localhost:1158" it opens oracle login page and also successfully logged in with username and password as "SYSTEM" and "12345", same using in my code, but while trying to run java program getting a exception.
my java program for testing database connection is:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Connect
{
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:#//localhost:1158:v$instance","SYSTEM","12345");
System.out.println("connected.."+con);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Exceptions are:
java.sql.SQLException: The Network Adapter could not establish the connection
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:480)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:413)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at abhishek.Connect.main(Connect.java:12)
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:328)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:421)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:630)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:206)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:966)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:292)
... 7 more
Caused by: java.net.UnknownHostException: //localhost
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:127)
at oracle.net.nt.ConnOption.connect(ConnOption.java:126)
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:306)
... 12 more
can anyone tell me what's wrong i have did and the meaning of the exceptions.
Port 1158 is for the DbConsole interface and won't work with JDBC.
The default port for the Oracle listener to which JDBC should connect is is port 1521.
Ok I am trying to connect to a mysql db with the following code. I tried looking at documentation but I am just having no luck what so ever.
Here is the code:
public class TESTSQL {
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://SLibraryDev.db.996****.hostedresource.com";
static final String USER = "SLD";
static final String PASS = "F11!";
public static void main(String[] args) {
Connection conn = null;
Statement stmt = null;
try {
// STEP 2: Register JDBC driver
Class.forName(JDBC_DRIVER);
// STEP 3: Open a connection
System.out.println("Connecting to database...");
conn = DriverManager.getConnection(DB_URL, USER, PASS);
...
}
This is the error I am getting :
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
When I comment out "Class.forName(JDBC_DRIVER)" and run it I get this error:
java.sql.SQLException: No suitable driver found for jdbc:mysql://SLibraryDev.db.996****.hostedresource.com
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
What I thought I needed to do was to download and run this : http://dev.mysql.com/downloads/connector/j/ which I did but it seemed like something was wrong with this installer...It seemed like it never finished, like it cut out in the middle of the process. Anyone have any ideas on what I need to do.
Download mysql-connector from following url
http://nearbuy.googlecode.com/files/mysql-connector-java-5.1.13-bin.jar
and add it to your class path.
If you are using netbeans, to add this file to your project do followoing
Right click on your project>click libraries>click add JAR/Folder> then select downloaded jar file
You need to download the mysql jdbc driver jar and include it in your classpath
java.sql.SQLException: No suitable driver found for jdbc:mysql://SLibraryDev.db.996****.hostedresource.com
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
clearly suggests that there is no driver in your class path
simply add the mysql driver jar file in to class path