Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Question on error on calling stored procedure from Java

  Asked By: Steven    Date: Oct 09    Category: Java    Views: 909

I have a method that call a stored procedure and I seem to be getting the following error:

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect. Invalid URL.

at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)

at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)

at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)

at java.sql.DriverManager.getConnection(Unknown Source)

at java.sql.DriverManager.getConnection(Unknown Source)

at com.wja.jms.Test01.TestWriteMessageToDB.updateTables(TestWriteMessageToDB.java:166)

at com.wja.jms.Test01.TestWriteMessageToDB.main(TestWriteMessageToDB.java:41)

at com.wja.jms.Test01.TestJMSSubscriber01.onMessage(TestJMSSubscriber01.java:113)

at com.seebeyond.jms.client.STCMessageConsumer.onMessage(STCMessageConsumer.java:515)

at com.seebeyond.jms.client.STCSession.onMessage(STCSession.java:253)

at com.seebeyond.jms.sockets.ConsumerSocket.deliverMessage(ConsumerSocket.java:337)

at com.seebeyond.jms.sockets.ThreadPerConnectionMgr$ConnThread.run(ThreadPerConnectionMgr.java:230)

I have also included the code below: The database is called resend as noted below.

CallableStatement cs;
Connection mYconnection = DriverManager.getConnection ("jdbc:microsoft:sqlserver://localhost:1433/resend", "wade", "pass");
// Call a procedure with one IN parameter
cs = mYconnection.prepareCall("call update_rsnd_Counter_1(?,?,?,?,?,?,?,?,?)");

// Set the value for the IN parameter
cs.setInt(2, 100);
cs.setString(3, "managerwa");
cs.setString(4, "serverwa");
cs.setInt(5, 25600);
cs.setString(6, "eventTypewa");
cs.setString(7, "T");
cs.setString(8, "2005-11-30");
cs.setString(9, "This is an awsome test that may fail");
// Execute the stored procedure



2 Answers Found

Answer #1    Answered By: Woodrow Jones     Answered On: Oct 09

The problem is for "/resend" part of the url. I think you should remove this part.

Answer #2    Answered By: Iris Sanders     Answered On: Oct 09

I think u make dsn and use jdbc:odbc it is better

Connection co = DriverManager.getConnection("jdbc:odbc:dsn name");

Didn't find what you were looking for? Find more on Question on error on calling stored procedure from Java Or get search suggestion and latest updates.