• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

how to get started with jdbc  RSS feed

Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!");}}

Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
Alexandre Bellezi Jos�
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!