• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MySQL Connector J5 exe

 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I want to connect my java application in to MySQL data base.But I haven't that special connector.If anyone have that, please send it to me.I need it in exe format.please help me.
My email - Dushantha12@gmail.com.

Thank You.
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dushantha,

It's a jar file actually which you use to connect to DB. Get it from here.
 
dushantha Rathnayake
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vijitha,

I tried to run it.but actually it's did not run.That because I expect that application in an exe format. Please help me.

Thank you.
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

dushantha Rathnayake wrote:I tried to run it.but actually it's did not run.


What you meant by "try to run it"?

That because I expect that application in an exe format. Please help me.


Don't get it, can you elaborate a little more?

BTW, how do you try to connect to DB, through JDBC or any other way?
 
dushantha Rathnayake
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Now the Driver is ok.but the connection was not ok.

import java.sql.*;
public class Main {
public static void main(String[] args) throws Exception {
Connection connection = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection("jdbc:mysql://localhost/low");
}
catch (Exception e) {
System.out.println(e);
}
}
}

general out in jcreator is :-

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.

Process completed.

Now what Iwant to do?
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags when posting code. You should provide username & password along with the URL in the "getConnection()" method. And are you able to connect to your MySQL server directly (i.e: from your command prompt or any GUI tool)?
 
dushantha Rathnayake
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I haven't any user name or password. Then I used this code.



but the result is same.

 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, there should be a username/password to access the DB. Can you connect to DB directly as I asked in the previous reply?
 
dushantha Rathnayake
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Connect to DB directly mean what? This is the code I only know to connect the db. Are there any other methods for connect DB? I have MySQL Workbench.I tried to create a password and user name.but there is a field, it is Pipe path.what is that?
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have MySQL Workbench


Well, MySQL Workbench is an ER modeling tool for MySQL, not a DB server. You can use it to for reverse engineering, SQL script generation and more.. You should have a MySQL server running, if not then download/install/configure it from here
 
dushantha Rathnayake
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Thank you very very much.....
I did it... I was connected the database and did my application functions.I did copy the connector (.jar file) in to,
And I did set CLASSPATH in environment variable section in Advance system settings.


Now it is ok.
Thank you again.
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

dushantha Rathnayake wrote:I did it... I was connected the database and did my application functions.I did copy the connector (.jar file) in to, C:\Program Files\Java\jdk1.6.0_10\jre\lib\ext\mysql-connector-java-5.1.12-bin.jar


Don't put third party libraries inside the JDK/JRE installation folder. It's a bad practise...
 
It means our mission is in jeapordy! Quick, read this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic