FireBird Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
파이어버드 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
IBPhoenix
FireBird Main site
볼랜드포럼 광고 모집

FireBird Q&A
[193] Re: 샘플소스및 필요사항
김재호 [] 2876 읽음    2002-04-01 16:15
ibserver와 interserver가 실행되고 있어야 하고,
jdk가 설치되어 있어야 합니다.
interclient.jar CLASSPATH 등록도 필요합니다.
http://www.ibphoenix.com/ibp_interclient.html

// Copyright InterBase Software Corporation, 1998.
// Written by com.inprise.interbase.interclient.r&d.PaulOstler :-)
//
// An example of using a JDBC 2 Standard Extension DataSource.
// The DataSource facility provides an alternative to the JDBC DriverManager,
// essentially duplicating all of the driver manager’s useful functionality.
// Although, both mechanisms may be used by the same application if desired,
// JavaSoft encourages developers to regard the DriverManager as a legacy
// feature of the JDBC API.
// Applications should use the DataSource API whenever possible.
// A JDBC implementation that is accessed via the DataSource API is not
// automatically registered with the DriverManager.
// The DriverManager, Driver, and DriverPropertyInfo interfaces
// may be deprecated in the future.

public final class DataSourceExample
{
  static public void main (String args[])
  {
    // Create an InterClient data source bean manually;
    // beans are normally manipulated by a GUI tool.
    // Bean properties are always set using the setXXX signature.
    interbase.interclient.DataSource dataSource = new interbase.interclient.DataSource ();

    // Set the standard properties
    dataSource.setServerName ("perdy");
    dataSource.setDatabaseName ("d:/databases/employee.gdb");
    dataSource.setDataSourceName ("Employee");
    dataSource.setDescription ("An example database of employees");
    dataSource.setPortNumber (3060);
    dataSource.setNetworkProtocol ("jdbc:interbase:");
    dataSource.setRoleName (null);
   
    // Set the non-standard properties
    dataSource.setCharSet (interbase.interclient.CharacterEncodings.NONE);
    dataSource.setSuggestedCachePages (0);
    dataSource.setSweepOnConnect (false);

    // Connect to the InterClient DataSource
    try {
      dataSource.setLoginTimeout (10);
      java.sql.Connection c = dataSource.getConnection ("sysdba", "masterkey");
      // At this point, there is no implicit driver instance
      // registered with the driver manager!
      System.out.println ("got connection");
      c.close ();
    }
    catch (java.sql.SQLException e) {
      System.out.println ("sql exception: " + e.getMessage ());
    }
  }
}







허재혁 님이 쓰신 글 :
: 이번것은 좀 짧은 소스네요...
: 역시 컴파일은 되는데, 실행이 되질 않네요...부탁드립니다.
: 좀 살펴보니까.. InterBase에서는 자체의 자바라이브러리에 의해서 DB연결을 하는 것 같군요.
: Connection, Statement, ResultSet.....
:
: <예제 및 에러 메세지>
: import interbase.interclient.*;
: import java.util.*;
:
: public class Conecta {
:     public static void main(String[] args) {
:         try {
:             String dbUrl = "jdbc:interbase://196.1.8.90/f:/EasyDemo.gdb";
:             String user = "SYSDBA";
:             String password = "asinforuser";
:             Properties props = new Properties();
:             // Load the driver (registers itself)
:             Class.forName("interbase.interclient.Driver");
:             props.setProperty("USERNAME", user);
:             props.setProperty("PASSWORD", password);
:             java.sql.Connection c = java.sql.DriverManager.getConnection(dbUrl, props);
:         } catch (Exception e) {
:             System.out.println(e);
:         }
:     }
: } ///:~
: /*
: And the error message is:
:
: C:\WINDOWS\TEMP\Pruebas Interbase>java Conecta
: Exception in thread "main" java.lang.VerifyError: (class: interbase/interclient/
: ErrorKey, method: _$372 signature: (Ljava/lang/String;Ljava/lang/String;I)V) Exp
: ecting to find unitialized object on stack
: at interbase.interclient.Driver.connect(Driver.java:180)
: at java.sql.DriverManager.getConnection(Unknown Source)
: at java.sql.DriverManager.getConnection(Unknown Source)
: at Conecta.main(Conecta.java:16)
:
: Thanks.
: Beni.
: */

+ -

관련 글 리스트
191 자바(JDBC)에서 InterBase 연결하기2탄 허재혁 2454 2002/04/01
193     Re: 샘플소스및 필요사항 김재호 2876 2002/04/01
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.