JDBC problems

Hi,
Im a total newbie with JDCB and not much better with JSP. Im trying to create a jsp log in page that checks the userName against a DB with the user name and password in it.
My main and imediate problem is, is that i dont know how to open a connection to a table that i create on the hdd. Also, would it be better to have a create table statment in the jsp code that gets created after a check is done to see that the table doesnt exist, or to create the table and link to it. As i said im a little bit on the new side to all of this, any help would be appreciated muchly.
I did a Google search, they come up with some good info, but not how to connect to the table that is sitting on my hdd, as far as i can tell. Thanks.

If you're a total newbie to JDBC, you should give this a look:
http://java.sun.com/docs/books/tutorial/jdbc/
You need a JDBC driver to connect to a database. There's a JDBC-ODBC bridge driver that comes with the JDK (class sun.jdbc.odbc.JdbcOdbcDriver), but usually the vendor that supplies your database has one available for download. (M$ Access is usually accessed using the bridge driver.)
Your app should not be creating that table. It's more typical for the database to already exist, and your app simply connects to it. You'd work with a DBA to design, implement, and populate the schema before your app was turned on.

Similar Messages

  • Remote JDBC Problem with Oracle BPM Studio

    Hi all, i am facing the Remote JDBC Problem with Oracle BPM Studio.
    When i configure a Remote JDBC Connection for SQL in BPM Studio, it prompt me an error.
    The SQL Connection is configured as following :
    External Resource:
    Name : MyDS
    Type : SQL Database
    Supported Types : Remote JDBC
    Details:
    Database Type : BPM's Oracle Driver Version:10, 11
    J2EE : WLS
    Lookup Name : MyAppDS
    Configuration for "WLS"
    Name : WLS
    Type : J2EE Application Server
    Supported Types : GENERIC_J2EE
    Details:
    Initial Context Factory : weblogic.jndi.WLInitialContextFactory
    URL : t3://localhost:7001
    But, when i try to connect to the Database by using this configuration, I will get an Exception.
    An exception occurred while getting a resource from a connector.
    Detail:The connector [[ MyDS : SQL : REMOTE_JDBC ]] caused an exception when getting a resource.
    Caused by: An exception occurred while getting a resource from a connector.
    Detail:The connector [[ WLS : J2EE : J2EE ]] caused an exception when getting a resource.
    Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory [[ Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory ]]
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
         at javax.naming.InitialContext.init(InitialContext.java:223)
         at javax.naming.InitialContext.<init>(InitialContext.java:197)
         at fuego.jndi.FaultTolerantContext.createContext(FaultTolerantContext.java:726)
         at fuego.jndi.FaultTolerantContext.<init>(FaultTolerantContext.java:79)
         at fuego.connector.impl.GenericJ2EEConnector.createInitialContext(GenericJ2EEConnector.java:177)
         at fuego.connector.impl.GenericJ2EEConnector.createStandaloneContext(GenericJ2EEConnector.java:98)
         at fuego.connector.impl.BaseJ2EEConnector.getResource(BaseJ2EEConnector.java:92)
         at fuego.connector.impl.BaseJ2EEConnector.getResource(BaseJ2EEConnector.java:76)
         at fuego.connector.J2EEHelper.getReadOnlyContext(J2EEHelper.java:86)
         ... 12 more
    Edited by: user2262377 on Jun 22, 2009 4:01 PM

    I guess the weblogic.jar is not included in the studio.
    So, i added weblogic.jar (Weblogic 10.3) and wlclient.jar (Weblogic 10.3)
    It is working in my simple java code. But, still not working in BPM Studio.
    The error logs:
    An exception occurred while getting a resource from a connector.
    Detail:The connector [OFT_APP_DS:SQL:REMOTE_JDBC] caused an exception when getting a resource.
    Caused by: java.lang.Object cannot be cast to java.io.Serializable
    fuego.connector.ConnectorException: An exception occurred while getting a resource from a connector.
    Detail:The connector [OFT_APP_DS:SQL:REMOTE_JDBC] caused an exception when getting a resource.
         at fuego.connector.ConnectorException.exceptionOnGetResource(ConnectorException.java:88)
         at fuego.connector.JDBCHelper.getReadOnlyConnection(JDBCHelper.java:93)
         at fuego.sqlintrospector.BrowserPanel.connect(BrowserPanel.java:395)
         at fuego.sqlintrospector.BrowserPanel.populateTree(BrowserPanel.java:200)
         at fuego.ui.wizards.ui.CheckTreeBrowser$1.construct(CheckTreeBrowser.java:63)
         at fuego.ui.SwingWorker$2.run(SwingWorker.java:39)
         at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.ClassCastException: java.lang.Object cannot be cast to java.io.Serializable
         at weblogic.iiop.IIOPOutputStream.writeAny(IIOPOutputStream.java:1588)
         at weblogic.iiop.IIOPOutputStream.writeObject(IIOPOutputStream.java:2231)
         at weblogic.utils.io.ObjectStreamClass.writeFields(ObjectStreamClass.java:413)
         at weblogic.corba.utils.ValueHandlerImpl.writeValueData(ValueHandlerImpl.java:235)
         at weblogic.corba.utils.ValueHandlerImpl.writeValueData(ValueHandlerImpl.java:225)
         at weblogic.corba.utils.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:182)
         at weblogic.iiop.IIOPOutputStream.write_value(IIOPOutputStream.java:1963)
         at weblogic.iiop.IIOPOutputStream.write_value(IIOPOutputStream.java:2001)
         at weblogic.iiop.IIOPOutputStream.writeObject(IIOPOutputStream.java:2266)
         at weblogic.jdbc.common.internal.RmiDataSource_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
         at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
         at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

  • JDBC Problem with Oracle 8.1.7. and OC4J  Version 2

    I use the following connection statement with Oracle 8.1.7. and JDeveloper 3 and Apache Server. It works fine.
    String user = "scott/tiger";
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection("jdbc:oracle:oci8:"+user+"@RDL");
    The same program does not obtain the connection with JDeveloper 9i, OC4J Version 2 and Oracle 8.1.7. I do not receive any error message, no exception is thrown.
    Please help me.

    Hi Avi,
    I had already tried the thin Diriver but after yout help I try again.
    With this thin driver, I received a SQLException which helps me.
    As usual, there were a lot of different problems. The main one was that my default configuration do not use the jdbc/lib817 main jdbc/lib. There is a classe12.jar in these libs that are apparently different.
    Finally, I obtain the connection with the "thin" driver.
    Thank you very much Avi!
    Reni

  • Help ! ! !Oracle 8.1.7, Linux, JDBC problem

    We have been troubleshooting a problem with our recently installed Linux (mandrake 8.0) Oracle DB Server. Everything seems to run fine, except JDBC connections. Whenever we connect to the server with one of our Java applications, JSP, Servlet, etc... the first time it works, then all other java apps get:
    java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
    ... also, our connect strings are correct... seems to be a problem with the listener...
    this only happens on the linux server and not solaris.
    Here is the listener.ora file
    # LISTENER.ORA Network Configuration File: /disk1/OraHome1/network/admin/listener.ora
    # Generated by Oracle configuration tools.
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = warf))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 216.174.11.57)(PORT = 1521))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /disk1/OraHome1)
    (PROGRAM = extproc)
    (SID_DESC =
    (GLOBAL_DBNAME = warf.world)
    (ORACLE_HOME = /disk1/OraHome1)
    (SID_NAME = warf)
    )

    Also,
    If I stop the listener and restart it... it works, but only for the first JDBC connection... ODBC seems uneffected.

  • Sender JDBC Problem

    Hi
    can any one hlp me..
    My scenrio is JDBC is sender and file is Receiver.
    problem is JDBC adapter is hitting the SQL server and retrived the data and  Inbound message and Receivng Grouping Payload ..like this..
    <?xml version="1.0" encoding="utf-8" ?>
    - <resultset>
    - <row>
      <TransactionNumber>118</TransactionNumber>
      <CompanyCode>1004</CompanyCode>
      <CustomerNumber>1368986</CustomerNumber>
      </row>
    Response payload is showig only name space..of frist two lines..
    <?xml version="1.0" encoding="UTF-8" ?>
      <ns0:resultset_mt xmlns:ns0="urn:Poll_Database_File" />
    even MessageData and Audit  logs showing successfully delivered ..
    Other than soap content  in Message Content showing only name space of xml...first two lines..
    So please let me know , where i did mistake?
    Regards..Rambarki

    Sharavan..the SQL statement is working fine..
    otherwise i wont get this payload in Inbound Message
    <?xml version="1.0" encoding="utf-8" ?>
    - <resultset>
    - <row>
      <TransactionNumber>118</TransactionNumber>
      <CompanyCode>1004</CompanyCode>
      <CustomerNumber>1368986</CustomerNumber>
      </row>
    - <row>
      <TransactionNumber>254</TransactionNumber>
      <CompanyCode>1004</CompanyCode>
      <CustomerNumber>2755685</CustomerNumber>
      </row>
    see u can find the data in payload..but thing is repsonse payload showing like this..
    <?xml version="1.0" encoding="UTF-8" ?>
      <ns0:resultset_mt xmlns:ns0="urn:Poll_Database_File" />
    only..
    i didn;t understand..what is this error/
    regards
    sankar

  • Php curl connection & mysql connection from netbeans (jdbc) problem

    I set up a LAMP stack on my laptop for development of TYPO3 a cms. Everything is cushty but two issues remain where I'm at my wits end.
    In netbeans I cannot connect to the mysql database using the jdbc driver and specifying the localhost. My php application can using the same credentials.
    I realized that I cannot connect to the mysql from the command line either if I use the loopback dress.
    this works: mysql -u root -p -h localhost   
    this doesn't: mysql -u  root -p -h 127.0.0.1                                                                     
    > ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111) 
    In my php application I have the problem that I cannot fetch a file via curl and fopen. I have tried both and curl/allow_fopen are enabled in the php.ini but no luck.
    since both problems are permission related it's only the /etc/hosts.allow which comes to mind which could cause a problem but I already allowed everything the hosts.allow
    # /etc/hosts.allow                                                                                         
    rpcbind: 192.168.1.0/255.255.255.0                                                                                                             
    mysqld: ALL : allow                                                                                                                           
    ALL: 127.0.0.1 : allow                                                                                                                         
    httpd: ALL : allow                                                                                                                             
    ALL : ALL : allow
    #/etc/hosts
    127.0.0.1               localhost       localhost.localdomain   lt-tom-arch                                                                   
    Any idea what I'm missing? What can I use to debug the issue further
    #php.ini
    [PHP]
    engine = On
    short_open_tag = Off
    asp_tags = Off
    precision = 14
    y2k_compliance = On
    output_buffering = 4096
    zlib.output_compression = Off
    implicit_flush = Off
    unserialize_callback_func =
    serialize_precision = 100
    allow_call_time_pass_reference = Off
    safe_mode = Off
    safe_mode_gid = Off
    safe_mode_include_dir =
    safe_mode_exec_dir =
    safe_mode_allowed_env_vars = PHP_
    safe_mode_protected_env_vars = LD_LIBRARY_PATH
    error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
    disable_functions =
    disable_classes =
    expose_php = On
    max_execution_time = 300
    max_input_time = 60
    memory_limit = 128M
    error_reporting = E_ALL & ~E_DEPRECATED
    display_errors = Off
    display_startup_errors = Off
    log_errors = On
    log_errors_max_len = 1024
    ignore_repeated_errors = Off
    ignore_repeated_source = Off
    report_memleaks = On
    track_errors = Off
    html_errors = Off
    error_log = /var/log/php.log
    variables_order = "GPCS"
    request_order = "GP"
    register_globals = Off
    register_long_arrays = Off
    register_argc_argv = Off
    auto_globals_jit = On
    post_max_size = 8M
    magic_quotes_gpc = Off
    magic_quotes_runtime = Off
    magic_quotes_sybase = Off
    auto_prepend_file =
    auto_append_file =
    default_mimetype = "text/html"
    include_path = ".:/usr/share/pear"
    doc_root =
    user_dir =
    extension_dir = "/usr/lib/php/modules/"
    enable_dl = Off
    file_uploads = On
    upload_max_filesize = 12M
    max_file_uploads = 20
    allow_url_fopen = On
    allow_url_include = On
    default_socket_timeout = 60
    extension=gettext.so
    extension=json.so
    extension=mcrypt.so
    extension=curl.so
    extension=gd.so
    extension=mysql.so
    extension=openssl.so
    [Date]
    date.timezone = America/Montreal
    [filter]
    [iconv]
    [intl]
    [sqlite]
    [sqlite3]
    [Pcre]
    [Pdo]
    [Pdo_mysql]
    pdo_mysql.cache_size = 2000
    pdo_mysql.default_socket=
    [Phar]
    [Syslog]
    define_syslog_variables = Off
    [mail function]
    SMTP = localhost
    smtp_port = 25
    mail.add_x_header = On
    [SQL]
    sql.safe_mode = Off
    [ODBC]
    odbc.allow_persistent = On
    odbc.check_persistent = On
    odbc.max_persistent = -1
    odbc.max_links = -1
    odbc.defaultlrl = 4096
    odbc.defaultbinmode = 1
    [Interbase]
    ibase.allow_persistent = 1
    ibase.max_persistent = -1
    ibase.max_links = -1
    ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
    ibase.dateformat = "%Y-%m-%d"
    ibase.timeformat = "%H:%M:%S"
    [MySQL]
    mysql.allow_local_infile = On
    mysql.allow_persistent = On
    mysql.cache_size = 2000
    mysql.max_persistent = -1
    mysql.max_links = -1
    mysql.default_port =
    mysql.default_socket =
    mysql.default_host =
    mysql.default_user =
    mysql.default_password =
    mysql.connect_timeout = 60
    mysql.trace_mode = Off
    [MySQLi]
    mysqli.max_persistent = -1
    mysqli.allow_persistent = On
    mysqli.max_links = -1
    mysqli.cache_size = 2000
    mysqli.default_port = 3306
    mysqli.default_socket =
    mysqli.default_host =
    mysqli.default_user =
    mysqli.default_pw =
    mysqli.reconnect = Off
    [mysqlnd]
    mysqlnd.collect_statistics = On
    mysqlnd.collect_memory_statistics = Off
    [Session]
    session.save_handler = files
    session.use_cookies = 1
    session.use_only_cookies = 1
    session.name = PHPSESSID
    session.auto_start = 0
    session.cookie_lifetime = 0
    session.cookie_path = /
    session.cookie_domain =
    session.cookie_httponly =
    session.serialize_handler = php
    session.gc_probability = 1
    session.gc_divisor = 1000
    session.gc_maxlifetime = 1440
    session.bug_compat_42 = Off
    session.bug_compat_warn = Off
    session.referer_check =
    session.entropy_length = 0
    session.entropy_file =
    session.cache_limiter = nocache
    session.cache_expire = 180
    session.use_trans_sid = 0
    session.hash_function = 0
    session.hash_bits_per_character = 5
    url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
    [MSSQL]
    mssql.allow_persistent = On
    mssql.max_persistent = -1
    mssql.max_links = -1
    mssql.min_error_severity = 10
    mssql.min_message_severity = 10
    mssql.compatability_mode = Off
    mssql.secure_connection = Off
    [Assertion]
    [COM]
    [mbstring]
    [gd]
    [exif]
    [Tidy]
    tidy.clean_output = Off
    [soap]
    soap.wsdl_cache_enabled=1
    soap.wsdl_cache_dir="/tmp"
    soap.wsdl_cache_ttl=86400
    soap.wsdl_cache_limit = 5
    [sysvshm]
    [ldap]
    ldap.max_links = -1
    [mcrypt]
    [dba]
    #my.cnf
    [client]
    port = 3306
    socket = /var/run/mysqld/mysqld.sock
    [mysqld]
    port = 3306
    socket = /var/run/mysqld/mysqld.sock
    datadir = /var/lib/mysql
    skip-external-locking
    key_buffer = 16M
    max_allowed_packet = 1M
    table_cache = 64
    sort_buffer_size = 512K
    net_buffer_length = 16K
    myisam_sort_buffer_size = 8M
    skip-networking
    server-id = 1
    [mysqldump]
    quick
    max_allowed_packet = 16M
    [mysql]
    [isamchk]
    key_buffer = 20M
    sort_buffer_size = 20M
    read_buffer = 2M
    write_buffer = 2M
    [myisamchk]
    key_buffer = 20M
    sort_buffer_size = 20M
    read_buffer = 2M
    write_buffer = 2M
    [mysqlhotcopy]
    interactive-timeout

    Regarding Curl/fopen I'm one step further. PHP cannot resolve hostnames and can connect only if an IP is specified. I resolved the domain I needed manually in the hosts file and it works. it appears it cannot use the systems DNS or the system doesn't allow it to use DNS. I have other ubuntu servers in the network who can resolve just fine.
    any idea what could be causing this?
    Could it have something to do with my nsswitch.conf? Should there be another dns somewhere?
    # Begin /etc/nsswitch.conf
    passwd: files
    group: files
    shadow: files
    publickey: files
    hosts: files dns
    networks: files
    protocols: files
    services: files
    ethers: files
    rpc: files
    netgroup: files
    # End /etc/nsswitch.conf

  • Distributed transactions/jdbc problem WL60

    Hi
              Our company has aworking application running on WLS5.1sp9.
              Im in the process of migrating it to WL6.0sp2.
              Our domain has 2 clusters each running 2 servers:
              1) servlet engines (handling http requests from clients, running servlets
              and jsp's)
              2) ejb containers (runnigour entities and session beans, working with Oracle
              8i database using connection pool and TxDataSource)
              The scenario:
              - a client request invokes a servlet on one of the servlet engines.
              - the servlet opens a jndi context to one of the ejb containers
              - the servlet open a transaction on a UserTransaction stub on that ejb.
              - then the servlet calls an entity bean using a home interface looked up
              using the same context.
              - the entity bean uses DataSource lookup in its own servers jndi to rerieve
              a connection.
              and then i get the following exception:
              java.sql.SQLException: No default driver for database type:
              jdbc:weblogic:jts
              at
              weblogic.jdbcbase.t3.Driver.seeIfWeNeedToInferDriverNameAndUrlFrom(Driver.ja
              va:456)
              at weblogic.jdbcbase.t3.Driver.getAllPropsFrom(Driver.java:255)
              at weblogic.jdbcbase.t3.Driver.connect(Driver.java:75)
              at weblogic.jdbcbase.jts.Driver.createRemoteConnection(Driver.java:199)
              at weblogic.jdbcbase.jts.Driver.connect(Driver.java:134)
              at
              weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java
              :44)
              at com.unisfair.util.DBHelper.getConnection(DBHelper.java:43)
              the transaction toString() gives:
              transaction=(IdHash=7541556,Name = [EJB
              UserBeanImpl.generateSessionSuffix()],Xid=2:b53da78d3c1badbb,Status=Active,n
              umRepliesOwedMe=0,numRepliesOwedOthers=1,seconds since begin=0,seconds
              left=30,activeThread=Thread[ExecuteThread: '8' for queue: 'default',5,Thread
              Group for Queue:
              'default'],ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=new,assig
              ned=none),SCInfo[ejb2]=(state=active),SCInfo[servlet2]=(state=active),SCInfo
              [ejb1]=(state=active),properties=({weblogic.transaction.name=[EJB
              UserBeanImpl.generateSessionSuffix()], weblogic.jdbc=t3://10.0.0.31:7007}))
              However the error happens on the other ejb server 10.0.0.33:7007
              It seems that the jts driver tries to get a remote connection on the server
              that coordinates the transaction but uses the deprecated t3 driver.
              I hope someone can help us since this problem is a good enough reason for us
              not moving on to WL6.0 we also looked at WL6.1 Beta and theres nothing new
              about it either.
              thanks
              Dror Last
              Senior Software Engineer
              Unisfair Inc.
              12 Yad Haruzim St. Tel Aviv 67778 Israel
              Tel: +972-3-5373738 Ext. 243
              Fax: +972-3-5373731
              GSM: +972-55-723710
              mailto:[email protected]
              http://www.unisfair.com/
              

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by JDBC_TX ():
    In the readme file of Oracle JDBC drivers 8.1.6.0.1 (http://technet.oracle.com/software/tech/java/sqlj_jdbc/files/Readme_01.txt)
    it mentioned that it supports "distributed transactions".
    As I understand, JDBC transaction is connection based and uses Oracle internal transaction manager. In order to do "distributed transactions", I must have at least two connections open at the same time each to its own database instance. How does the two connections coordinate the transactions? I thought in order to support "distributed transactions", one has to build a higher layer to encapsulate the two connections and therefore coordinate the distributed transactions. Any examples will be welcome.<HR></BLOCKQUOTE>
    The two branches of the transaction are coordinated using 2-phase commit.
    For samples look under
    $ORACLE_HOME/jdbc/demo/samples/oci8/jdbc20-samples/
    null

  • Oracle JDBC problem in Java/log4j

    HI,
    I am using log4j in my java application to log error messages using JDBCAppender to record the messages in DB tables.
    I am getting this error in JDeveloper.
    log4j:ERROR Failed to excute sql
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    Here is my log4j.properties file.
    log4j.appender.JDBC2=org.apache.log4j.jdbc.JDBCAppender
    log4j.appender.JDBC2.driver=oracle.jdbc.driver.OracleDriver
    log4j.appender.JDBC2.url=jdbc:oracle:thin:@Server:port:instance
    log4j.appender.JDBC2.user=user
    log4j.appender.JDBC2.password=password
    Note: I am able to log messages using FileAppender.
    Please let me know if anybody have any solutions for this problem.
    Siva.

    Abirami,
    This problem got solved as the static variables used for the JDBCAppender class are case sensitive.
    I modifed the variables Driver and URL. Now it is working for me.
    Here is the corrected code:
    log4j.appender.db=org.apache.log4j.jdbc.JDBCAppender
    log4j.appender.db.Driver=oracle.jdbc.driver.OracleDriver
    log4j.appender.db.URL=jdbc racle:thin:server:1523 bname
    log4j.appender.db.user=username
    log4j.appender.db.password=password
    log4j.appender.db.sql=INSERT INTO LOG VALUES ('%d %-5p -%F %m')
    log4j.appender.db.layout=org.apache.log4j.PatternLayout
    log4j.appender.db.layout.ConversionPattern=%d %-5p - %m
    log4j.appender.db.Threshold=debug

  • SQL Server/JDBC Problems...

    I know this topic has been posted before, and believe me I've read all of it and followed instructions at least 5 times over. But I just can't get rid of :
    Got an exception!
    [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
    On my SQL server side:
    1) My Client Network Utility and Server Network Utility both have TCP enabled and default port set to 1433
    2) I've set authentication to "SQL Server and Windows" instead of just "windows".
    3) For now I'm using my 'sa' account as startup which is set to "SQL Server and Windows" authentication.
    4) I've disabled and then enabled TCP a bunch of times, that doesn't seem to help.
    5) My SQL Server log says:
    2005-02-22 10:12:12.86 server SQL server listening on Shared Memory, Named Pipes.
    It should say something about TCP according to the MS SQL help, but I've had no luck with that.
    I've even tried NMAP on my computer to check for open TCP ports, and 1433 doesn't show up. My guess is the problem is with SQL Server 2000 (I'm using Java 1.5.0_01 for now). Is there some kind of trick (ritual? animal sacrifice?) needed to get SQL Server to start listening on TCP? God knows I''ve tried everything short of kicking the **** out of my purchased boxed set. Please...any help in the matter would be GREATLY appreciated. Thanks

    I had the same problem on my windows XP laptop.
    For windows XP you need SQL Server 2000 service pack 3.
    Of course you may not be using windows XP but the service pack will not hurt.

  • Re: WebLogic RDB jdbc problem

    Hi Joe,
    I tried the two things you asked:
    1. Setting the initial and max capacity of the Connection Pool to 1 does not make
    any further difference, the reselt set is still sometimes empty.
    2. If I use the code from the stand-alone application (thus if I get the connection
    directly from the driver) than I get a good result: the retrieved result set is,
    as far as I can see, always correctly filled.
    In addition I tried to cast the Connection to WLConnection and then get the vendor
    connection from it, and than to proceed with this connection further on, but this
    did not make it any better.
    Almir.
    Joe Weinstein <[email protected]> wrote:
    >
    >
    Almir wrote:
    Hi Joe,
    thanks for your quick answer to my questions. I red your sugestionsand tried
    them out but unfortunately it did not make me come any further in searchfor answer
    to this odd problem. Setting the statement cache size to 0 (I've alreadytried
    this before your response) did not make any difference at all. Refreshingthe
    statement before reuse neighter.
    I also tried to make the stand-alone application to go wrong. But nomatter whether
    I reuse connection and/or statement or whether I instantiate the newones every
    time, the execution of the statement always comes back with a validand filled
    ResultSet.
    Interesting thing to mention aboout executing the statement withinthe server
    is that if I put it in a loop of let say 100 repeats, it succeeds orit fails
    all 100 times. Next time i execute this bean method where the loopis situated
    it will again succeed or fail all 100 times. It remains consequentwithin the
    same loop/bean method. Even if I get the data source and the connectionevery
    time again (100 times) it remains consequent. Thi is maybe interestingfinding
    but it does not say anything to me. Perhaps you can make some conclusionsout
    of it.
    Best regards,
    Almir.Hmmmmm.... Interesting. The only other thing I can suspect is that the
    driver
    is not threadsafe... Would you try these two experiments?
    1 - Alter the weblogic server to define the pool to have only one connection,
    ie: initial capacity = 1 and max capacity = 1. Let me know if the
    problem
    is still there.
    2 - Alter the application code you run in the server to get a connection
    directly
    from the driver, just like the standalone code.
    Let me know...
    Joe
    Joe Weinstein <[email protected]> wrote:
    Hi Almir.
    I highly suspect the RDB driver of a bug where re-using a given Prepared
    Statement
    will sometimes produce an empty result set. Weblogic will cache your
    prepared statements
    so when you call prepareStatement() we may transparently return you
    a
    previously-used
    statement for the same SQL and arguments.
    To prove my theory, please do these two things:
    1 - Define your pool's statement cache to be of size zero. This should
    make the problem
    go away.
    2 - In a standalone program, you can create a given PreparedStatement,
    and rerun it in
    a loop, and see if it ever returns an empty result set. I will showyou
    how to include
    the code we do to refresh the statement before reuse:
    try
    Class.forName ("oracle.rdb.jdbc.rdbThin.Driver");
    Connection conn = DriverManager.getConnection("jdbc:rdbThin://<database_name>","<user>",
    "<pass>");
    String sqlStatement = "SELECT TABEL1.COLUMN1, TABEL1.COLUMN2,
    TABEL2.COLUMN1
    FROM TABEL1, TABEL2 WHERE (TABEL2.COLUMN2= TABEL1.COLUMN3) AND (TABEL2.COLUMN1
    = ?)ORDER BY TABEL1.COLUMN1";
    PreparedStatement ps = conn.prepareStatement(sqlStatement,
    ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    for (int i = 0; i < 100; i++)
    ps.setObject(1, new Integer(1));
    boolean result = ps.execute();
    ResultSet rs = ps.getResultSet();
    // check result set here
    rs.close();
    cleanUpStatementForReUse(ps);
    ps.close();
    conn.close();
    catch (Exception ex)
    System.out.println(ex);
    private void cleanUpStatementForReUse(PreparedStatement p)
    try { p.clearParameters(); p.clearBatch(); } catch (Throwable ignore)
    try { p.setEscapeProcessing(true); } catch (Throwable ignore) {}
    try
    if (p.getFetchDirection() != ResultSet.FETCH_FORWARD)
    p.setFetchDirection(ResultSet.FETCH_FORWARD);
    } catch (Throwable ignore) {}
    try
    if (p.getFetchSize() != 0)
    p.setFetchSize(0);
    } catch (Throwable ignore) {}
    try
    if (p.getMaxFieldSize() != 0)
    p.setMaxFieldSize(0);
    catch (Throwable ignore) {}
    try
    if (p.getMaxRows() != 0)
    p.setMaxRows(0);
    catch (Throwable ignore) {}
    try
    if (p.getQueryTimeout() != 0)
    p.setQueryTimeout(0);
    catch (Throwable ignore) {}
    try
    p.clearWarnings();
    catch (Throwable ignore) {}
    Almir wrote:
    Hello everybody,
    we are developing an application for Bea WebLogic Application Server8.1. This
    application uses data from an existing database. This is an OracleRDB 7-1.220
    database. Because the WebLogic AS does not include a JDBC driver forthis type
    of database we got one from Oracle: RDBJDBC71. I installed this driverand tested
    it by using a standalone Java application which executes a number
    of
    SQL statemens.
    This test was satisfying, no problems occured.
    Then, in order to use it within the application server, I defined
    a
    JDBC Connection
    Pool in WebLogic with corresponding Data Source. And it worked, ourapplication
    could connect with the database and execute the needed transactions.
    But after a while we noticed a realy strange problem. When a particularSELECT
    SQL stament is executed we expect a list of 6 records as result. Butsometimes
    the returned resultset is just empty. I tried this hundreds of times.No error
    or exception occurs but sometimes the response is correct and sometimesnot.
    In the first place we thought that the JDBC driver was causing thisproblem but
    then I executed the same SQL Select statement within a Java stand-aloneapplication
    (and not using the Application Server) and the result was correct.Repeating this
    hundreds of times did not change the outcome, the given resultset
    was
    always correct.
    I tried reconfigurating the Connection Pool in different ways but
    it
    did not make
    any difference: sometimes it worked and sometimes it didn't.
    Here below you can see the code samples of both implementations.
    Stand-alone:
    try
    Class.forName ("oracle.rdb.jdbc.rdbThin.Driver");
    Connection conn = DriverManager.getConnection("jdbc:rdbThin://<database_name>","<user>",
    "<pass>");
    String sqlStatement = "SELECT TABEL1.COLUMN1, TABEL1.COLUMN2,TABEL2.COLUMN1
    FROM TABEL1, TABEL2 WHERE (TABEL2.COLUMN2= TABEL1.COLUMN3) AND (TABEL2.COLUMN1
    = ?)ORDER BY TABEL1.COLUMN1";
    PreparedStatement ps = conn.prepareStatement(sqlStatement,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    ps.setObject(1, new Integer(1));
    boolean result = ps.execute();
    ResultSet rs = ps.getResultSet();
    // Result set is here always filled!!!!
    rs.close();
    ps.close();
    conn.close();
    catch (Exception ex)
    System.out.println(ex);
    Application server:
    try
    Context ctx = new InitialContext();
    Object object = ctx.lookup(data_store_name);
    DataStore ds = (DataStore)object;
    Connection conn = ds.getConnection();
    String sqlStatement = "SELECT TABEL1.COLUMN1, TABEL1.COLUMN2,TABEL2.COLUMN1
    FROM TABEL1, TABEL2 WHERE (TABEL2.COLUMN2= TABEL1.COLUMN3) AND (TABEL2.COLUMN1
    = ?)ORDER BY TABEL1.COLUMN1";
    PreparedStatement ps = (PreparedStatement)conn.prepareStatement(sqlStatement,
    ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    ps.setObject(1, new Integer(1));
    boolean result = ps.execute();
    ResultSet rs = ps.getResultSet();
    // Result set is here sometimes empty !!!!
    rs.close();
    ps.close();
    conn.close();
    catch (Exception ex)
    System.out.println(ex);
    Any sugestions are welcome.
    Thanks.
    Almir.

    I have had the same problem as you with sporadic results for queries with RDB Drivers. Were you able to solve it and if so how?
    Sam Opoku-Boadu

  • Very strange Access / JDBC problems

    Hi there,
    I am running a simple jdbc program which uses MS Access 2000.
    I am getting this really strange problem. My program does not update the table and throws no exception - when I run the same program through a remote debugger - it does update the table.
    Is there any known JDBC / Access problems?
    Many Thanks

    There's no such thing as 91% Java Developer - you're either certified or you're not. Sounds like you're 0%.
    If you're really that knowledgable about Java, go back and re-read your question. Ask yourself: "Could the problem be me? Is there anything I'm doing wrong with JDBC that could have caused this?" I think it's likely. I'm telling you that I can insert, delete, and update with Access via the JDBC-ODBC bridge and make them stick. If you can't, I'd say you've done something wrong.
    Access 2000, Win 2000/XP Professional, JDK 1.4.1 are what I'm using. If those are the versions you've got, then there's no bug. It's you.
    JDBC-ODBC bridge isn't a M$ product, either. You can find bugs on it in the database.
    I don't see how anybody here has been that abusive of you. (I've read far worse.) It sounds like your ego would prefer that the problem lie elsewhere than inside your code.
    Do you want to make your code work or not? If so, stop calling us idiots and post something so we can take a look.
    I'd get a new ID. If you don't want to be treated as a newbie, don't use a newbie name. - MOD

  • JDBC Problem Part III (SQL error?)

    Hey,
    I tried to add a column to a working JDBC request. I received an error that predicated, that the column does not exist:
    <i>Error when executing statement for table/stored proc. 'dbo.myTable' (structure 'STATEMENT'): java.sql.SQLException: FATAL ERROR: Column 'softwareSubID' does not exist in table 'dbo.myTable'</i>
    But I checked the the table and the column exists and is also correct written (case sensitiv).
    The column type is smallint, but it works also with another column of this type. I tested the field with the tool "SQL Query Analyser" with this statement:
    <i>Select * from dbo.myTable where softwareSubID = 1</i>
    and it response correct data.
    Does anyone has experience with this problem?
    Thanks
    chris

    You are right. That works. Unbelievable that such bugs exists. I would have never tried this.
    10 points for you
    thanks
    chris

  • JDBC Problem with Netscape Enterprise Server 3.61

    I have created a servlet->JDBC(Thin driver for Oracle 7.3) model to communicate the ORacle Database on an UNIX box by using Netscape Enterprise Server 3.61. I got the following problems and if anyone could help me. Many many thanks.
    java.lang.IllegalAccessError: JdbcDriver at
    WhitePageSearch.doGet(WhitePageSearch.java:75) * at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:252) at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:330) at
    sun.servlet.netscape.NSRunner.run(NSRunner.java:144) at
    netscape.server.applet.ServerApplet.handleRequest(ServerApplet.java:69)
    at netscape.server.applet.HttpApplet.handleRequest(HttpApplet.java:680)
    By the way. This model works fine on the servletrunner on my NT machine and I guess there are some problem on the Nescape Server setting.

    You need to install the Netscape Proxy plug-in.
    You can find the plug-in at the BEA download site along with the instructions.
    Once downloaded it took about 5 minutes to update a config file and have everything running.
    Good Luck...
    Daniel Astillero <[email protected]> wrote:
    How can I configure Netscape Enterprise Server 3.5.1 to use WebLogic 5.1?

  • Variables expression in the JDBC. problems need help!

    Dear Sir,
    I am a beginner of using JDBC. I have a problem in the variable expression.
    the fragment code is below
    int today = 20041009;
    ResultSet rs = statement.executeQuery("select * from recorder where bookeddate >= 'today' order by bookeddate");
    I want to order the "booked date" and select the date after today. Unfortunately, it doesn't work. Any person can tell me how to add variable 'today' in to the SQL? I used mySQL
    If this question is tooo stupid, please forgive me.
    Thanks
    Daan

    Dear Sir,
    I am a beginner of using JDBC. I have a problem in the
    variable expression.
    the fragment code is below
    int today = 20041009;
    ResultSet rs = statement.executeQuery("select * from
    recorder where bookeddate >= 'today' order by
    bookeddate");
    I want to order the "booked date" and select the date
    after today. Unfortunately, it doesn't work. Any
    person can tell me how to add variable 'today' in to
    the SQL? I used mySQL
    If this question is tooo stupid, please forgive me.
    what type of field is bookeddate.. a DATE or TIMESTAMP?
    the format you have is a TIMESTAMP.
    once you have solved the problem of actually including the variable in your query (as the previous poster mentioned) if you still have difficulty make sure you are using the right format for the given field.
    you might well want to look at using prepared statements as well because they will handle the formatting for you.. you will need to convert your int variable today into an actual Date object though.

  • Informix JDBC Problem

    Hi!
    We're using Informix 7 + WL6sp1 + Informix JDBC Driver v2.2. We have a connection
    pool and connect to the pool using:
    Driver myDriver = (Driver) Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:weblogic:pool:poolname");
    The problem is as follows:
    Every time we modify a stored procedure (DROP ... CREATE ...) our app fails when
    trying to use that stored procedure. We have to shut down the server and restart
    it in order to keep going.
    The stack trace:
    java.sql.SQLException: SPL routine(disponibilidad_hot) is no longer valid.
    at com.informix.jdbc.IfxSqli.addException(IfxSqli.java, Compiled Code)
    at com.informix.jdbc.IfxSqli.receiveError(IfxSqli.java, Compiled Code)
    at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java, Compiled Code)
    at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java, Compiled Code)
    at com.informix.jdbc.IfxSqli.sendStatementQuery(IfxSqli.java, Compiled
    Code)
    at com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java, Compiled
    Code)
    at com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java, Compiled
    Code)
    at com.informix.jdbc.IfxResultSet.executeQuery(IfxResultSet.java, Compiled
    Code)
    at com.informix.jdbc.IfxStatement.executeQueryImpl(IfxStatement.java,
    Compiled Code)
    at com.informix.jdbc.IfxPreparedStatement.executeQuery(IfxPreparedStatement.java,
    Compiled Code)
    at weblogic.jdbc.pool.PreparedStatement.executeQuery(PreparedStatement.java,
    Compiled Code)
    at es.gesfor.bd.ObtenerDatos.ejecutar(ObtenerDatos.java, Compiled Code)
    at es.gesfor.servlets.FiltrosServlet.obtenerHoteles(FiltrosServlet.java,
    Compiled Code)
    at es.gesfor.servlets.FiltrosServlet.doPost(FiltrosServlet.java, Compiled
    Code)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java,
    Compiled Code)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java,
    Compiled Code)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java,
    Compiled Code)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java, Compiled
    Code)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)

    Hi Federico,
    It happens because weblogic caches prepred statements.
    Though the name of the stored procedure remains the same,
    it's a different object from the database point of view, which is
    why a mismatch between cache and database occurs.
    You may consider setting size of the prepared statement
    cache to zero. That should solve the problem. Later, when
    the SP code is stabilized, you will be able to turn in on back.
    Regards,
    Slava Imeshev
    "Federico Dios" <[email protected]> wrote in message
    news:[email protected]...
    >
    Hi!
    We're using Informix 7 + WL6sp1 + Informix JDBC Driver v2.2. We have aconnection
    pool and connect to the pool using:
    Driver myDriver = (Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:weblogic:pool:poolname");
    The problem is as follows:
    Every time we modify a stored procedure (DROP ... CREATE ...) our appfails when
    trying to use that stored procedure. We have to shut down the server andrestart
    it in order to keep going.
    The stack trace:
    java.sql.SQLException: SPL routine(disponibilidad_hot) is no longer valid.
    at com.informix.jdbc.IfxSqli.addException(IfxSqli.java, CompiledCode)
    at com.informix.jdbc.IfxSqli.receiveError(IfxSqli.java, CompiledCode)
    at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java, CompiledCode)
    at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java, CompiledCode)
    at com.informix.jdbc.IfxSqli.sendStatementQuery(IfxSqli.java,Compiled
    Code)
    at com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java,Compiled
    Code)
    at com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java,Compiled
    Code)
    at com.informix.jdbc.IfxResultSet.executeQuery(IfxResultSet.java,Compiled
    Code)
    atcom.informix.jdbc.IfxStatement.executeQueryImpl(IfxStatement.java,
    Compiled Code)
    atcom.informix.jdbc.IfxPreparedStatement.executeQuery(IfxPreparedStatement.jav
    a,
    Compiled Code)
    atweblogic.jdbc.pool.PreparedStatement.executeQuery(PreparedStatement.java,
    Compiled Code)
    at es.gesfor.bd.ObtenerDatos.ejecutar(ObtenerDatos.java, CompiledCode)
    ates.gesfor.servlets.FiltrosServlet.obtenerHoteles(FiltrosServlet.java,
    Compiled Code)
    at es.gesfor.servlets.FiltrosServlet.doPost(FiltrosServlet.java,Compiled
    Code)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java,Compiled Code)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java,Compiled Code)
    atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    Compiled Code)
    atweblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java,
    Compiled Code)
    atweblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    Compiled Code)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java,Compiled
    Code)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, CompiledCode)

Maybe you are looking for

  • Everything is so slow after I updated to 10.7.2...Help:(

    I have a Macbook pro 15''.. Bought this Aug. Everything is so slow after I updated to 10.7.2 ..... Especially now it takes me 1 min to turn on my laptop... which used need only 10 sec. So does Turn off...before update it is 2 sec, now it is 30 sec...

  • Error when running report: "Error in aggregate table for InfoCube"

    Hi Experts We had a temporary error, which I would like to find the root cause for. We where running a Workbook which is based on a multiprovider. For a short period of time (around 10 minuts) we got the following error when we executed the workbook

  • Help w/10g-XE Install on Ubuntu

    Hello world, I have a (new to me) Ubuntu OS on which I am trying to make Oracle 10G-XE behave. I have searched many threads here and elsewhere on the web, but still cannot find an answer to the problems I am encountering. I have d/l'ed the 10g-XE deb

  • Windows 8.1 BUG - Cannot right click wi-fi networks

    There are various threads on this with so many really bad answers. You guys really need to recognize that you broke the function and have to put it back. In windows 8.1 you cannot go to wi-fi, right click Answers I have seen is go to PC settings, Net

  • How can I back up 8 gigs of photos to a disc?

    My folder has gotten too big. how do I save 8 gigs of pics to a dvd for archive?