Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Database connection

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to connect to a database on an IBM HTTP server using JDBC?

I am using the following code:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String myDB ="jdbc:odbc:Driver={SQLServer};Server=http://xxxx.sldc.sbc.com;Database=abcd.com";
Connection con = DriverManager.getConnection(myDB,"","");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from customer");

But I am getting an error.
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are loading Type 1 driver to create a OBBC connection.
  • Did you Set up ODBC Data Source .
  • connection string for jdbc-odbc connection is jdbc:odbc:dsnName

  • where dsnName is the odbc datasource name

    Thanks,
    Shailesh
     
    Ranch Hand
    Posts: 1325
    Android Java Windows
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    But I am getting an error.



    what error? would you please paste here.. so it may helps other to find a solution for you..

    and this entry might help you in creating a dynamic DSN

    and please use UBB Code to make your post more readable...
    [ September 14, 2008: Message edited by: Muhammad Saifuddin ]
     
    Bartender
    Posts: 10336
    Hibernate Eclipse IDE Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    To follow on from what Shailesh Chandra has already written, are you aware that there are proper type-4 JDBC drivers available from SQL Server? No need to use the JDBC-ODBC bridge.
     
    aditya chitre
    Greenhorn
    Posts: 4
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    This is the error I am getting:
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][Named Pipes]Specified SQL server not found.

    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)

    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)

    at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3074)

    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:3

    23)

    at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)

    at java.sql.DriverManager.getConnection(DriverManager.java:512)

    at java.sql.DriverManager.getConnection(DriverManager.java:171)

    at Java_Excel.main(Java_Excel.java:42)
     
    aditya chitre
    Greenhorn
    Posts: 4
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Where do I get information on type 4 drivers?
     
    Ranch Hand
    Posts: 1143
    1
    Eclipse IDE Oracle Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Aditye,
    You asked:


    Where do I get information on type 4 drivers?


    Did you try searching the Internet?
    (And pardon me if I am stating the obvious.)

    Good Luck,
    Avi.
     
    Seriously Rick? Seriously? You might as well just read this tiny ad:
    the value of filler advertising in 2021
    https://coderanch.com/t/730886/filler-advertising
    reply
      Bookmark Topic Watch Topic
    • New Topic