please help me....
i'm planning to build a project "user friendly my sql"
i.e user don't need to write statements in sql..he will have to click on buttons nd he is done..
like he will click on button "create table"... then it will ask table name and atrtributes etc...
but i have a problem in connectivity..
how to login in to my sql?..
i want to connect to sql server... bt there is no specific database to which i want to connect.. as user will bulid his own database...
can anyone tell me the code for it....???
this would be my final year project that i'm starting so i need your help guys...!!!
Welcome to JR.
First, what you really need is an introduction to JDBC and the great start will be the Sun Tutorial Next, you have to learn that each Database has some technique to get connection through Java and also depned upon the type of driver used.So you have to create the connection string as per the Database selected and get the connection, once the connection establish, it mens you can ping to the database and next you can ask user for tables, etc.
still i have doubt...
i know how to connect to a database...using jdbc odbc driver..please read following line.....
Connection conn =DriverManager.getConnection("jdbc:mysql://localhost:3306/db2","root","prakki");
these are the lines which i wrote to connet with database db2...
bt i want to know that what should i do if every user will create his own database after login ??
Don't called me Sir, (It felt like I got some white hair on my head)
nehaa jain wrote:bt i want to know that what should i do if every user will create his own database after login ??
Let them create as many database/schema as they want to create. You don't have to worry about that.
Here is some steps I can suggests:
1. Ask User the the database vendor (like MySQL, SQL Server, etc), once he selected you load the driver for that database
2. Next ask for the database name.
3. Create the connection string using the above information.
4. Once the successful connection establish, then you can create table, SP, add/delete/update rows, etc.
Another option can be - instead of dealing with these different database vendors - MySQL, SQL Server, Sybase, Oracle etc; you could embed a Java Database in your application - Apache Derby ( http://db.apache.org/derby/ ) can be used.