473,657 Members | 2,385 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Java database connection problem in Eclipse

3 New Member
Hello,

I have written a java program that can connect with a mysql server.
When i run the program in Eclipse it works fine, when i create a jar
and run the program outside eclipse the program can't connect with the mysql server, The mysql database driver is named on the classpath so tha't not the problem..

Does anybody know this problem?

Greats
Gerard Smink
[ email address removed; read the guidelines -- mod ]
Mar 10 '08 #1
5 2456
BigDaddyLH
1,216 Recognized Expert Top Contributor
Hello,

I have written a java program that can connect with a mysql server.
When i run the program in Eclipse it works fine, when i create a jar
and run the program outside eclipse the program can't connect with the mysql server, The mysql database driver is named on the classpath so tha't not the problem..

Does anybody know this problem?

Greats
Gerard Smink
[ email address removed; read the guidelines -- mod ]
Application that have been "jarred" do not (and should not ;-) rely on an external class path:

http://java.sun.com/docs/books/tutor...jar/index.html
Mar 10 '08 #2
gerardsmink
3 New Member
you're right i mean he manifest file is right

Manifest-Version: 1.0
Class-Path: mysql-connector-java-3.1.14-bin.jar
Main-Class: Main

so I have no idea where I did something wrong?

Someone an idea?

Greatz
Mar 10 '08 #3
BigDaddyLH
1,216 Recognized Expert Top Contributor
you're right i mean he manifest file is right

Manifest-Version: 1.0
Class-Path: mysql-connector-java-3.1.14-bin.jar
Main-Class: Main

so I have no idea where I did something wrong?

Someone an idea?

Greatz
Then do you put a copy of file mysql-connector-java-3.1.14-bin.jar in the same folder are your application's jar? What is the error message that gets generated?
Mar 10 '08 #4
gerardsmink
3 New Member
thanks for your help
the fault was that eclipse automatical genearate
the manifest file.. in de manifest the Class-path not listened..
Now i have made the manifest file by my self en it works fine

Greatz
Mar 12 '08 #5
BigDaddyLH
1,216 Recognized Expert Top Contributor
thanks for your help
the fault was that eclipse automatical genearate
the manifest file.. in de manifest the Class-path not listened..
Now i have made the manifest file by my self en it works fine

Greatz
Good work! I'm not an Eclipse user, it may be useful in the future if you found an easy way to do this from within the Eclipse IDE. There are Eclipse forums out there and they'd be more likely to know how to do this.
Mar 12 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2475
by: R Reyes | last post by:
Hi, I'm trying to modularize my database connections a little better and get more out of my project with less code. First check out this common dbOpen() function inside class clsDatabase. I removed the try/catch part as it is not important for my question: // This function opens a connection to the database. public static SqlConnection dbOpen() { // Create a SqlConnection object and pass in our connection string
1
3390
by: Macca | last post by:
Hi, I have a C# Solution/Application that contain 4 projects. Each of these projects needs at some time to access the same database. I would like to know how to share a single connection between these projects as i assume this would be more efficient than having a separate connection string for each project.
2
3488
by: Bryan | last post by:
Hello, I'm just starting to develop in asp.net and i have a question about using a database connection globally in my app. I have set up the procedures for getting all my connection string info which each page will use, but my question relates to how to use the database connection i create in all my classes. I have a database class, in a separate namespace and file, i created that handles all the connection opening, executing statements...
3
10287
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database I use System.Data.Common.DBConnection and .DBCommand. How can I keep aware from connection losses (network not availeable, db-server not available...)? Are there any strategies to detect this broken connections, and how can I
35
4831
by: Terry Jolly | last post by:
Web Solution Goal: Have a global database connection Why: (There will be 30+ tables, represented by 30+ classes) I only want to reference the database connection once. I put the connection string in the web.config. I created a class with a static database connection and the class opens and closes the database.
6
3435
by: Arsalan Ahmad | last post by:
Hi all, I am creating a website in which in an Item detail page there are a number of web controls (7 or 8) and what is happening that inside each of control's Page_Load() function I am creating a database object to query data from database (using MySQL database). So it means that for each page request I am using 7 or 8 database connection which is something quite bad as far as performance is concerned. So please tell me how can change...
0
1186
by: jegray | last post by:
I am very much a beginner in dealing with connection statments. I am getting the following error: Microsoft OLE DB Provider for ODBC Drivers error '80004005' Data source name not found and no default driver specified /default.asp, line 32 Here is my connection include:
3
4885
by: fniles | last post by:
In the Windows application (using VB.NET 2005) I use connection pooling like the following: In the main form load I open a connection using a connection string that I stored in a global variable g_sConnectionString and leave this connection open and not close it until it exits the application. Then on each thread/each subsequent sub that needs the connection I create a local OleDBConnection variable, open the connection using the exact...
8
4729
by: Ananthu | last post by:
Hi I have done all the codings part for connecting mysql with java in eclipse environment. Coding Part: import java.sql.Connection; import java.sql.DriverManager; public class MysqlConnect {
0
8420
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.