LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-12-2008, 07:33 AM   #1
mokoena
LQ Newbie
 
Registered: Jul 2008
Location: Lesotho
Posts: 2

Rep: Reputation: 0
Question Wrote java program and can't connect to sql database


HI GUYS!

Um new to linux and i wrote a java program trying to connect to sql
database,my problem is that i can't find the location for my database.
I created a database with the name "New" and tried to use this directory "jbdc:mysql://localhost/New" but connection can't be established.
Can someone help me with the directory for created databases?
 
Old 07-12-2008, 10:01 AM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
Code:
jbdc:mysql://localhost/New
This is a JDBC connection string, not a directory.

The string looks right, assuming that you are using MySQL, and "New" is the name of the database that you are connecting to.

First make sure that the MySQL server is running on the local machine, and that you have created the "New" database; you might try connecting with the mysql command-line. It might well be that MySQL has downcased the name to "new", for example.

This will show you the currently defined databases, as MySQL sees them:
Code:
echo "show databases;" | mysql -u username -p
You don't have to use MySQL as a database back-end; managed databases are very powerful but do involve setting quite a lot up. You might try using a JDBC provider that doesn't require a full managed database service to be running, such as hypersonic (http://www.hsqldb.org/), just to verify that there isn't anything wrong with your Java code, before going back and fixing the database connection.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
TOMCAT connect to MS SQL database shane200_ SUSE / openSUSE 1 06-01-2005 01:41 PM
COnnect Oracle Database in Linux by C++ program!! nelnel Linux - Software 4 05-24-2005 10:13 PM
php trying to connect to local sql, error no such database feetyouwell Programming 11 02-08-2005 12:25 PM
Sql Problem (java Program) keikun_naruchan Programming 1 06-03-2004 10:19 PM
Embedded SQL -Unable to connect to PostgreSQL database vikram_cvk Linux - Software 1 05-30-2004 06:14 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration