Home

Forums

Web development

 

 

 

 
     
 
dna88 Web development and Technology Forum
 
Profile   Register   Memberlist   Usergroups   FAQ   Search  Log in
Connecting to MYSQL without using a dummy database

 
Post new topic   Reply to topic    dna88 Forum Index -> Databases Discussion Forum
Author Message
Mastermind
Expert User
Expert User


Joined: 23 Apr 2004
Posts: 181
Location: Birmingham,UK

Post Post subject: Connecting to MYSQL without using a dummy database Reply with quote

Hi everyone,

Is it possible to create a database from java (e.g name supplied by the user at the beginning instead using a pre-created or a dummy one) ?It seems that I have to connect to an already existing database before executing any statement (look at the following codes).
Code:

public void createDatabase(String DBName) throws Exception {                Connection conn;                 
Statement st=null;                 
ResultSet rs=null;
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost/ttdatabase");  // look at this line                 
st = conn.createStatement();
. . .
. . .

_________________
Keep your own dignity, both online and offline throughout your life !!!
Tue Jun 01, 04 3:17 am
Back to top
Mastermind View user's profile Send private message
dude
Power User
Power User


Joined: 10 Mar 2004
Posts: 376
Location: Savar, Dhaka

Post Post subject: Reply with quote

I read in a Java book that creating a database is not defined as part of the ANSI SQL/DDL language, and it is not in JDBC.

This means that you need to inspect your database vendors documentation how databases can be created, plus whether this is somehow supported via their JDBC drivers (which is not in most cases).
Tue Jun 08, 04 12:12 am
Back to top
dude View user's profile Send private message Visit poster's website
kaeud31
Just In
Just In


Joined: 02 Dec 2004
Posts: 7

Post Post subject: Reply with quote

Hi everyone :
You first need to create a database with MYSQL they use the java program to display the data contained in the database.I did java in class last semester.
Mon Dec 06, 04 12:18 am
Back to top
kaeud31 View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    dna88 Forum Index -> Databases Discussion Forum All times are GMT - 7 Hours
Page 1 of 1

 

Partners and Resources

Bangladesh hosting company

Bangladesh web design

Driven by phpBB © phpBB Group