| |

VerySource

 Forgot password?
 Register
Search
Author: cm200red

Java query SQLServer encountered a problem: the object name is invalid.

[Copy link]

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-13 14:15:01
| Show all posts
The easiest way is to delete this table and rebuild it. Maybe the problem will be solved. I have encountered such a problem before, but it is not in java. It is done directly in the query analyzer and deleted the table. It can be used after rebuilding, and I haven't figured out why until now, which expert can give pointers!
Reply

Use magic Report

2

Threads

12

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-8-13 15:00:01
| Show all posts
But the problem is, I have no problem querying this in the query analyzer.

It is invalid when querying in java.
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-13 15:45:01
| Show all posts
Simply change the name of the table below.
Databases with user fields often have such errors
And with name
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-27 18:00:01
| Show all posts
Has it been solved? I have encountered the same problem?
I use jdbc:jtds to connect to the database
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-27 18:15:01
| Show all posts
I solved it. The reason was that there was a problem when connecting. Modify the connection to the database:
For example: "jdbc:jtds:sybase://10.200.4.193:5000; DatabaseName=GOLDSIGN"
Change to: "jdbc:jtds:sqlserver://127.0.0.1:1433/GOLDSIGN";
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-27 18:30:01
| Show all posts
What's the difference!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-27 18:45:01
| Show all posts
Haha, beginners are generally very careless
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-27 19:00:01
| Show all posts
UserInfo may be some spare, special characters in the database, so try to use those strings as table names and field names as little as possible!
Create a new one! Addition tb_userInfo
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-27 19:15:01
| Show all posts
Of course, copying directly to java is not enough.The string copied is inconsistent with the statement you execute in the query analyzer.

Modify your query statement to be similar to the following statement
str = "SELECT id from userInfo where name = "+'strwww'+" and password = "+str00000;
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-1 14:00:01
| Show all posts
Adding the use database name before the query statement can solve this problem
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list