This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes how to get started with jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "how to get started with jdbc" Watch "how to get started with jdbc" New topic

how to get started with jdbc

Alexandre Bellezi Jos�

Joined: Aug 03, 2007
Posts: 16
Iam having a problem with jdbc.
I want to insert and retrieve data from a database in SEQUEL SERVER 7 RDBMS on a database server on network.Iam a client to that server and have SEQUEL SERVER (client) installed on my machine.
what are the drivers i need to install and how can i get the connection.
im using the following code and getting the runtime error.

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class SimpleConnection1
public static void main(String args[])
try{Connection con = null;
String url = "jdbc dbc:<database name on server>";
con = DriverManager.getConnection(url,"sa","");
Statement stmt = con.createStatement();
stmt.executeUpdate("INSERT INTO hindi1"+" VALUES(nitin)");
catch (Exception e){System.out.println("problem inserting its very tight");}
System.out.println("Connection successful!");}}

Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
You need to take a look at the Tutorial provided by Sun on JDBC. In your example, you haven't registered a Driver, and you URL appears to be incomplete. One good place to check is if anyone where you work has a working program that does the connection, if not there should be an example program with your JDBC Driver try and start there.

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Ajay Kumar
Ranch Hand

Joined: Apr 28, 2000
Posts: 87
Hi abj,
As Carl T. has pointed out first of all U need to register the driver for jdbc-odbc. In this case it will be

U need to create a DSN (either a UserDSN or System DSN) with your ODBC in the control panel (let's say it is named test1)
Then your connection statement should look like
String url = "jdbc: odbc:test1";
Be sure that your SQL server is up and running and test your DSN thru the ODBC panel before U get all sorts of error messages on the java console.
Reply here if you have any problems and I can mail U some sample code of connecting to a SQL server later in the day.
Ajay Kumar

[This message has been edited by Ajay Kumar (edited June 19, 2000).]

Regds<BR>Ajay Kumar
Alexandre Bellezi Jos�

Joined: Aug 03, 2007
Posts: 16
i dont have an odbc driver for sequel installed on my machine. And i tried to download it from net but i could not find any suitable site to download it from.
The code given above compiles well if i use a registered access database but at runtime it gives error that no suitable driver available,sequel state: 08001,error code : 0.
Please give the url from where i can download the jdbc dbc driver for sequel.
thanks in anticipation.
I agree. Here's the link:
subject: how to get started with jdbc
jQuery in Action, 3rd edition